Referenced Responses with '../' not resolving correctly - I think
See original GitHub issueDescribe the bug I am not sure if this is a bug. But I have a schema that has numerous includes:
index.yaml
....
/v1/foo:
$ref: './resources/foo/paths.yaml'
....
paths.yaml
post:
...add the before
requestBody:
description: Details to create test
content:
application/json:
schema:
$ref: './models.yaml#/MyModel'
...add the rest
get:
...add the rest
models.yaml
MyModel:
allOf:
- $ref: "#/Test"
- type: object
properties:
test:
type: string
Having multiple operations in a file appears to produce an error. (I am going to investigate further.)
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: Cannot read property 'content' of undefined
at SchemaPreprocessor.extractResponseSchemaNodes (/~/project/node_modules/express-openapi-validator/dist/middlewares/parsers/schema.preprocessor.js:306:25)
at SchemaPreprocessor.gatherSchemaNodesFromPaths (/~/project/node_modules/express-openapi-validator/dist/middlewares/parsers/schema.preprocessor.js:97:49)
at SchemaPreprocessor.preProcess (/~/project/node_modules/express-openapi-validator/dist/middlewares/parsers/schema.preprocessor.js:56:24)
at /~/project/node_modules/express-openapi-validator/dist/openapi.validator.js:81:95
Nope I extended the paths file to have 3 operations and the error resurfaced. — further update It actually looks like the resolution of the $ref pointer in the responses is not working. When I logged it,
{
"401": { "$ref": "#/paths/~1v1~1tests/get/responses/401" }
}
My schema
responses:
401:
$ref: "../responses.yaml#/responses/UnauthorizedError"
— further update, I was able to continue developing by using refParser: dereference
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Examples referenced with $ref are not rendered correctly #4924
I would like add another argument to the case for resolution. Is the current behavior for schemas. As a developer trying to define...
Read more >15 Useful Customer Service Email Response Samples - Indeed
Learn how to properly respond to different types of customer interactions by using these customer service email response samples.
Read more >Conflict Resolution Skills - HelpGuide.org
When handled in a respectful and positive way, conflict provides an opportunity for growth. Learn the skills that will help.
Read more >HTTP response status codes - MDN Web Docs - Mozilla
The HTTP specification intends this status code to be used for "limited-time, promotional services". APIs should not feel compelled to indicate ...
Read more >Clarification - Communication Skills | SkillsYouNeed
Clarifying and Clarification · “I'm not quite sure I understand what you are saying.” · “I don't feel clear about the main issue...
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 Free
Top 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
Let me get you a in-depth schema. I will have time later this week.
I checked and in the latest two bumps everything resolves correctly.