Parse a modularized Swagger specification
Hello,
should it be possible to parse a modularized a Swagger specification?
The parsed Swagger Java Model does not contain the content of the referenced files.
Does the swagger-parser support JSON references for all attributes?
Or, can I only use JSON references for attributes which are parsed into a RefModel?
Example:
swagger: '2.0'
info:
$ref: "./info.yaml"
host: petstore.swagger.io
basePath: /v2
schemes:
- http
tags:
- name: pet
description: Pet resource
- name: store
description: Store resource
- name: user
description: User resource
paths:
$ref: "./paths.yaml"
parameters:
$ref: "./parameters.yaml"
responses:
$ref: "./responses.yaml"
definitions:
$ref: "./definitions.yaml"
securityDefinitions:
$ref: "./security_definitions.yaml"
Hi, only if the spec supports it. What you have here is not legal based on https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
ok. Thx
Means the following example (in the blog post) does not work, because swagger-parser does not support JSON references similar to https://github.com/whitlockjc/json-refs.
Blog post: http://azimi.me/2015/07/16/split-swagger-into-smaller-files.html
Would it make sense to integrate https://github.com/adjohnson916/jackson-json-reference into the swagger-parser?
json-refs is a standard mechanism, the spec supports them in only specific locations.
The blog post you mentioned is flat out wrong, and should not be referenced.
Recall this is not necessarily a technical limitation--of course references could be supported anywhere one wants but the specification--for good reason--does not support them being used arbitrarily.
Thanks. What are the good reasons? :)
This would be a good time to jump over to that repo and read the issues & comments, that's the place for these types of discussions
ok. Thank you anyway.
does it can generate sub package for deferent models? My file struct: index.yaml path/SeviceA/pathA.yaml path/SeviceB/pathB.yaml definitions/SeviceA/domain/A.yaml definitions/SeviceB/domain/A.yaml How to generate class folders like this: servicea servicea.domain serviceb seviceb.domain
@zcb22000 Please look at what is supported in the spec.