Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add the ability to remove the bits of JSON Schema that Swagger doesn't support #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

calvin1864
Copy link

I ran into a case where I needed to support JSON Schema files for validating an API (that contained code I didn't control) and creating documentation in Swagger.

So I created 'swagger bundle -j' which bundles swagger files and removes JSON Schema bits that Swagger refuses to understand ('id', '$schema'). Doing this allows me to maintain one set of files for two separate sets of tools

If you think this would be useful to others, feel free to merge. This is my first PR, so if you see anything that looks wrong/off, let me know. This comes with a test case, but I was having trouble running all tests on my Windows machine. I assume this works better on your box.

…t support

If you're already working with JSON Schema validation tools, then
this functionality makes using Swagger for documentation easier
@JamesMessinger
Copy link
Member

Thanks for the PR. I'm currently working on a plug-in model for Swagger Parser (and, by extension, Swagger CLI), and I think this is a perfect example of something that would make a great plug-in. So, I'll leave this PR open for now, and once I have all the plug-in stuff in place, you or I can refactor this to be a plug-in.

Copy link

@allonzy allonzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to do the same thing, using jsonSchema as openapi fragment is so underated, it allow for runtime validation, interface generation (in ts, java ...)

@calvin1864
Copy link
Author

It's been so long I forgot this PR existed.

Um. I assume what I wrote 5.5 years ago isn't fully compatible with what's here. Let me know if it's even worthwhile to adapt my new flag to what's here (or the plugin system if that ever came to be)

@allonzy
Copy link

allonzy commented Feb 22, 2022

Nah, don't bother we migrated to redocly

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

Successfully merging this pull request may close these issues.

3 participants