openapi-python-client icon indicating copy to clipboard operation
openapi-python-client copied to clipboard

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

Open AmeerSadek opened this issue 1 year ago • 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

AmeerSadek avatar Aug 13 '24 14:08 AmeerSadek

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.

KrisEhl avatar Aug 14 '24 19:08 KrisEhl