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

How can I get a resolved json? #87

Open
axpira opened this issue Jan 21, 2020 · 4 comments
Open

How can I get a resolved json? #87

axpira opened this issue Jan 21, 2020 · 4 comments

Comments

@axpira
Copy link

axpira commented Jan 21, 2020

I want to validate and get a json with all $ref resolved, how can I get this?

@HRogge
Copy link

HRogge commented Jan 23, 2020

OpenAPI 3.0 cannot process a JSON schema (as defined at json-schema.org), it uses a... superset of a subset of draft 04 of JSON schema... which also does references a little bit different. Lots of headaches for everyone... good news is that this might change with the coming OpenAPI 3.1.

See 1, 2 and 3 for more information.

So you might want to check first that the schemas you are referring to are valid OpenAPI 3.0 and not JSON Schema 0.5 or later.

@Jiehong
Copy link

Jiehong commented Mar 10, 2020

I want to do something similar: part of my openapi is sprend around multiple files, and the are referenced in the main file with "$ref", which is fine.

But I'd like to generate a single file representing that openapi, aka by replacing the content of each "$ref" by the content of the referenced file.

Is that possible with that lib? I couldn't find a way to make it happen.

@jayvdb
Copy link
Contributor

jayvdb commented Dec 7, 2022

It isnt possible with this validator afaics. You may be able to achieve that by creating a script that uses https://github.com/p1c2u/openapi-core . If you want a CLI tool, I found https://github.com/kstasik/schema-tools (Rust) which can do this and quite a few other neat tricks. - you will need my draft PR kstasik/schema-tools#61 to get it building.

@wcloete
Copy link

wcloete commented Jun 12, 2023

Maybe have a look at the ResolvingParser on https://github.com/RonnyPfannschmidt/prance ?

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

5 participants