openapi-generators/openapi-python-client

Getting "Invalid YAML from provided source" error although it worked with Postman and the spec format is JSON

AmeerSadek opened this issue · 1 comments

I am trying to generate a client for an OpenAPI JSON file but I am getting an error although Postman was able to generate a endpoints:
"Error(s) encountered while generating, client was not created
Invalid YAML from provided source: mapping values are not allowed in this context"

This is the link to the OpenAPI spec: https://github.com/sourcenetwork/defradb/blob/develop/docs/website/references/http/openapi.json

Desktop (please complete the following information):

  • OS: Windows 11
  • Python Version: 3.12.5
  • openapi-python-client version: 0.21.2

Hi,
you were likely using the link provided directly with the --url argument. This page contains additional information on top of the specs.

Instead you want to use the "Raw" version of that page, i.e. something like

openapi-python-client generate --url https://raw.githubusercontent.com/sourcenetwork/defradb/develop/docs/website/references/http/openapi.json

This allowed me to generate the client.
I just got some warnings regarding invalid http status code "default", you seem to have in your specs.