Skip to content
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

Update code generator to use new version of OpenAPI specification #233

Open
Xtansia opened this issue Apr 1, 2024 · 1 comment
Open
Assignees

Comments

@Xtansia
Copy link

Xtansia commented Apr 1, 2024

The https://github.com/opensearch-project/opensearch-api-specification repository has been updated to be written natively in OpenAPI, rather than being built from Smithy. This means that some structure and details of the specification has changed. The code generator should be updated to use this new version of the specification. Any changes to the generated output should be validated to confirm if the changes are correct by cross referencing with the OpenSearch implementation & documentation. Any errors found in the specification should be reported on the specification repository.

@dblock
Copy link
Member

dblock commented Jul 20, 2024

The existing ruby OpenAPI parser seems not to support OpenAPI 3.1, but I was still able to load our spec.

require 'open-uri'
require 'openapi3_parser'

openapi_url = "https://github.com/opensearch-project/opensearch-api-specification/releases/download/main-latest/opensearch-openapi.yaml"
openapi_path = "opensearch-openapi.yaml"
File.write(openapi_path, URI.open(openapi_url).read) unless File.exists?(openapi_path)
puts "Loading #{openapi_path} (#{File.size(openapi_path)} byte(s)) ..."

doc = Openapi3Parser.load_file(openapi_path)
puts "Loaded #{openapi_url} with #{doc.paths.size} path(s)."

doc.paths.keys.each do |key|
   puts key
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants