luckymarmot / Paw-SwaggerImporter

Swagger/OpenAPI 2.0 Importer for Paw
https://paw.cloud/extensions/SwaggerImporter
MIT License
38 stars 10 forks source link

Multifile-import #4

Closed tuexss closed 7 years ago

tuexss commented 9 years ago

Our swagger description is spread across several .yml-files, using something like

in: "formData"
$ref: "#/folder/secondfile.yml"

to pull in the real data. But this importer can only take a single file and doesn't follow the references. Would it make sense to add this as a feature, or is there some kind of tool I could use as preprocessor before the import?

tuexss commented 9 years ago

see https://github.com/swagger-api/swagger-spec/blob/master/guidelines/REUSE.md#parameters for how it's done

mittsh commented 9 years ago

@tuexss yes, it's true that it doesn't support this yet, and probably will be hard to manage due to app sandboxing, I suggest that as you said, you run the Swagger file through a preprocessor to embed all files, I'm not sure if that exists

did some quick search and couldn't find something that does that, but I found a few other libs/tools that don't support external references, so a "external reference flattener" would be super userful

tuexss commented 9 years ago

ok, thanks for the feedback, will think about it.

nosyjoe commented 8 years ago

had the same issue. I'm using swagger-cli as a preprocessor: install swagger-cli:

npm install -g swagger-cli

and then run swagger on the root yml file:

swagger bundle -r <root.yml>

importing works!

mittsh commented 8 years ago

@nosyjoe oh great, thanks for the tip! I'll add this to our Paw documentation until this issue is fixed

JonathanMontane commented 8 years ago

Actually, to be more precise:

$ref: "#/folder/secondfile.yml"

would not resolve to a different file as per the JSON pointer RFC used by swagger, but to a path within the current file.

A URI fragment falling under this issue would be

$ref: "/folder/secondfile.yml#/path/to/definition/in/schema"

more info on URIs

JonathanMontane commented 7 years ago

@tuexss The latest release of paw (paw 3.1) and the latest release of the swagger importer (SwaggerImporter v3.0.2) should fix this 2-year old issue.

mshahat commented 6 years ago

@JonathanMontane i'm coming to the same point , where i have a json swagger referencing other json schema files.

  1. dragged .json swagger file to Paw
  2. prompted to get an importer, used Swagger 2.0
  3. shown missing dynamic value as show in the screen shot
  4. prompted to installer json faker !

any documentation ? i'd like to understand the workflow for getting that working please

screen shot 2017-11-17 at 21 32 07

thanks in advance,