openapi-generators / openapi-python-client

Generate modern Python clients from OpenAPI
MIT License
1.26k stars 195 forks source link

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

Open AmeerSadek opened 1 month ago

AmeerSadek commented 1 month ago

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):

KrisEhl commented 1 month ago

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.