Order of resolution of references - resolve remotes first?
See original GitHub issueGiven this folder structure:
| index.yaml
| parameters.yaml
| responses.yaml
|
+---definitions
| | index.yaml
| |
| +---error
| | error_model.yaml
| | extended_error_model.yaml
|
\---paths
| index.yaml
Consider this yaml:
index.yaml
swagger: '2.0'
info:
version: 1.0.0
title: User API
description: User specific API
schemes:
- http
- https
produces:
- application/json
- text/json
paths:
$ref: ./paths/index.yaml
definitions:
$ref: ./definitions/index.yaml
parameters:
$ref: ./parameters.yaml
responses:
$ref: ./responses.yaml
responses.yaml
# Common responses
200:
description: OK
schema:
type: string
DefaultError:
description: Error payload
schema:
$ref: '#/definitions/ExtendedErrorModel'
extended_error_model.yaml
allOf:
- $ref: '#/definitions/ErrorModel'
- type: object
properties:
detail:
type: string
meta:
type: string
error_model.yaml
type: object
required:
- status
- code
- title
properties:
code:
type: integer
title:
type: string
status:
type: integer
minimum: 100
maximum: 600
SwaggerParser.validate('index.yaml')
fails because '#/definitions/ExtendedErrorModel'
doesn’t exist inside responses.yaml. However, if I use json-refs and js-yaml to load and parse the YAML, the resolution works.
I believe this is because json-refs first resolves all remote refs, then proceeds with local ones.
I’m not sure if the spec (OAI or json ref) dictates one way or the other. So I’m not sure if this is an issue or not.
Could you please shed some light on this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
git pull fails "unable to resolve reference" "unable to update ...
These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in "remotes/<name>". Share.
Read more >Module Resolution
A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency...
Read more >community/0060-remote-resource-resolution.md at main
Resource Resolution : The act of taking a reference to a Tekton resource in a Remote, fetching it, and returning its content to...
Read more >p4 resolve
Resolution of a file is completed when any of the accept dialog options are chosen. To resolve the file later or to revert...
Read more >How to resolve: git push remote: error: cannot lock ref .. ...
Solved: I'm struggling to solve an issues with one of my repositories. It started with a failed push from sourcetree, on attempting to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No problem. The good news is this feature was a pain to implement anyways so removing it makes my life easier. 👍
Closing this issue, since Swagger Parser is working as intended.