resolveFully doesn't resolve nested references or normal references for Callbacks and its PathItem usecase
See original GitHub issueOpenAPI version : 3.0.0 Swagger-parser 2.0.26
I am using the resolveFully parse option as mentioned here but seems its not working for most of my usecases WHICH INVOLVE CALLBACKS AND PATH ITEM FOR CALLBACKS
My use case INVOLVING CALLBACKS AND ITS PATH ITEM INSIDE IT are like below
- Resolving nested schemas that might be referenced from “#components/schemas/”
- Resolving requestBody referenced from “#components/requestBodies/”
- Resolving response referenced from “#components/responses/”
- Resolving callback referenced from “#components/callbacks/”
- Combination of point 2,1
- Combination of point 3,1
- Combination of point 4,3,21
Looks like an issue. Technically it should resolve the local references and place it as the inline definitions in the OpenAPI document java object, if I am not mistaken reading the mentioned here. And it does resolve for other normal PathItems but for not for callbacks specific use-cases mentioned 1-7.
Please refer the below OAS3 spec :
openapi: 3.0.0
info:
version: '1.0'
title: simple subscription service
description: subscription service
servers:
- url: 'http://localhost:8085/'
paths:
/subscriptions:
post:
description: creates a new subscription
operationId: createSubscription
parameters:
- $ref: '#/components/parameters/key'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Subscription'
responses:
'201':
$ref: '#/components/responses/SubscriptionSuccess'
'400':
$ref: '#/components/responses/respError'
'500':
$ref: '#/components/responses/respError'
callbacks:
notification:
$ref: '#/components/callbacks/Notification'
components:
callbacks:
Notification:
'http://localhost:8099/callback/endpoint':
post:
requestBody:
$ref: '#/components/requestBodies/Notification'
responses:
'200':
description: Your server returns this code if it accepts the callback
responses:
SubscriptionSuccess:
description: Subscription
headers:
id:
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/Subscription'
respError:
description: generic response for errors
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
requestBodies:
Notification:
content:
application/json:
schema:
$ref: '#/components/schemas/Notification'
description: Notification message when event has happened
required: true
parameters:
key:
description: consumer key
in: header
name: API-key
required: true
schema:
type: string
schemas:
Notification:
type: object
properties:
message:
type: string
id:
type: string
sender:
type: string
myObject:
type: object
properties:
myName:
type: string
myAge:
type: integer
format: int32
Subscription:
type: object
properties:
listOfNames:
type: array
items:
$ref: '#/components/schemas/myObject'
date:
type: string
format: date
limit:
type: integer
format: int32
Errors:
type: object
properties:
errors:
type: array
items:
$ref: '#/components/schemas/Error'
Error:
type: object
properties:
code:
type: string
message:
type: string
traceId:
type: string
status:
type: number
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
resolveFully doesn't resolve nested references or normal ...
Actually, the Callbacks PathItem related members were not getting resolved using the resolveFully ParseOptions that we set as shown in code snippet.
Read more >How to deal with nested callbacks and avoid “callback hell”
It's mind-boggling to see nested callbacks, but I don't think it's a “hell”. The “hell” can be manageable if you know what to...
Read more >Understanding the Event Loop, Callbacks, Promises, and ...
This section will explain how JavaScript handles asynchronous code with the event loop. It will first run through a demonstration of the event ......
Read more >JavaScript Callbacks Variable Scope Problem - Pluralsight
In this free JavaScript guide, you'll learn how to fix the common JavaScript callbacks variable scope problem. This step-by-step JavaScript ...
Read more >Rewriting nested callbacks with Promises and async/await ...
It's an old-fashioned JS code that illustrates the common struggle with nested callbacks in rl.question method calls. Here arrow function is used in...
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
Hi @gracekarina , I have added a sample OAS3 spec which has most of the scenarios that I expect the resolveFully API to resolve it and place inline wherever needed and return the OpenAPI document java object when we use the OpenAPIV3Parser for reading a spec.
Thanks @vpawar-tibco @gracekarina 🙌 v2.0.28 🤞