-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add a REST API OpenAPI specification #972
Comments
Summary of progress so far: The legacy Implementation of OpenAPI code generation has been successful with the use of Current updates: The endpoints which are not part of the REST API (i.e. the OCI proxy endpoint and registry viewer proxy endpoint) have been defined under the OpenAPI spec, this is because the validator that checks the endpoints against the spec does not allow requests for endpoints not in the spec itself, even if manually defined in the source. In addition, due to incompatibilities with the JSON schemas (i.e. devfile spec json file), the OpenAPI spec needs to rely on the already generated libraries using the Will provide more updates when I have done more testing with these changes. |
This change has been reverted due to OpenAPI 3.x spec not supporting proxy route paths. To bypass the OpenAPI validation, the middleware function is only applied to the REST API routes by setting it under |
Created #1146 to cover the OpenAPI conversion of the devfile specification part. |
Code generation is now being used during the build process, CI updated to install the dependency for the code generation. An additional workflow step for checking the commited source generated files for changes and prompting the author for an update to the source generation: https://github.com/michael-valdron/devfile-registry-support/blob/4c040e7598521fd440e0f39d80e600888053a42d/.github/workflows/ci.yaml#L45 Additional time provided to the target date for the size of the review process. |
Included documentation on OpenAPI source generation for the index server, tied PR devfile/registry-support#175 is ready for review. |
Which area this feature is related to?
/area api
/area registry
Which functionality do you think we should add?
Why is this needed? Is your feature request related to a problem?
As a developer, it would be easier to update the REST API if we had defined OpenAPI specification that codegens the the index server with the corresponding bindings. This would create a better workflow to understand what each route does. In addition, this would allow for better documentation and automated mock testing.
As a consumer, it would easier to consume the REST API if the documentation was clear and always up-to-date. In addition, this change would allow codegen of nonvendored types between languages Edit: After #1146 is completed.
Describe the solution you'd like
1. Use json-schema-to-openapi-schema to convert the devfile JSON schema to the OpenAPI schema.Covering this in #1146.2. Create the REST API OpenAPI schema with the
devfile OpenAPI schemareference to the Go schema of the devfile specification.3. Use oapi-codegen to codegen the index server with the corresponding bindings.
For more information on JSON schemas and OpenAPI schema read this.
Describe alternatives you've considered
We could codegen the OpenAPI specification from the source code. However, it is better convention to create the spec and then the source code.
Additional context
blocks #957Target Date: 07-11-2023
The text was updated successfully, but these errors were encountered: