-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API conversions and CI #26
Comments
One specific item mentioned in the last call was to try a one-off conversion of the Prysm protobuf to Swagger/OpenAPI to see what the output looks like |
The output of Prysm's generated OpenAPI can be found here: https://api.prylabs.net (raw json) |
I think it's easier to implement additional beacon apis manually with existing types (that contain validations and descriptions). I am in process of refactoring current openapi schema so routes/route groups are split into smaller files(less conflicts and it's easier to maintain smaller files). Reusing types also enable us to switch from hex to base64 by simply changing validation at base types. I find it cool to have ci generate multiple artifacts like protobufs and postman definitions and we can attach them to api releases. |
Regarding YAML, Lighthouse supports Regarding SSZ, Lighthouse presently supports
I haven't looked into mapping to protobuf any more than I've documented in ethereum/eth2.0-pm#141 (comment). I couldn't speak on how onerous this might be. So in terms of supporting YAML and SSZ via the REST API as alternative content-types to JSON, I don't think it's going to be particularly onerous or limiting from an implementation perspective. I think the challenge might be with documenting them. I need to look into OpenAPI a bit more, but I expect we can add YAML encoding to the spec for free. I'd expect defining the SSZ encoding would be more onerous. Perhaps @mpetrunic has thought about this. There's also the question about whether actually we want these encodings or not. I don't see a whole lot of value in YAML; I only added since it was a useful tool for the 2019 interop, however complying with eth2-testnet means that genesis states are now SSZ (not YAML). I could take it or leave it with YAML. SSZ might come in handy for a few reasons:
I'd be interested to hear about (2) from those researching phase 1+; does it seem like a common use case to want to manipulate SSZ from the BN API? |
We thought about that and it shouldn't be much of and issue to document them. responses:
200:
description: Success response
content:
application/json:
schema:
$ref: '#/components/schemas/Attestation' we can modify it like this for api endpoints that makes sense to return ssz responses:
200:
description: Success response
content:
application/json:
schema:
$ref: '../../beacon-node-oapi.yaml#/components/schemas/Attestation'
application/ssz:
schema:
type: string
description: "Base64 encoded output of SSZ serialized [Attestation](link to md file with object description) object"
example: "YXNkYXNkYXNk" Which looks like this in swagger: We would probably need to add md files containing "ssz description" for custom types that are not in spec repo so we can link them. |
I suppose if desired, we can also maintain That said, I'm not certain if mixing protos in here makes much sense. Any thoughts on that? |
Played around with generating a description of a gRPC service from openapi schema. |
API format is stable now |
It seems desirable for standard conversions to exist between formats (YAML, protosbufs, SSZ, etc), regardless of whichever format this API repo uses to spec things.
Base on conversations from the recent eth2 call, I propose the following
If the above investigations prove fruitful, then (following @paulhauner's suggestion) we should integrate autoconversions in the to CI to ensure that the API remains usable across the formats we explicitly want to support.
The text was updated successfully, but these errors were encountered: