-
-
Notifications
You must be signed in to change notification settings - Fork 483
Closed
Description
If multiple callback objects with same expression are exist, reference in some of these are not resolved by the loader.
package openapi3_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/getkin/kin-openapi/openapi3"
)
func TestXXX(t *testing.T) {
loader := openapi3.NewLoader()
doc, err := loader.LoadFromFile("testdata/issueNEW.yaml")
require.NoError(t, err)
err = doc.Validate(loader.Context)
require.NoError(t, err)
require.NotNil(t, (*doc.Paths["/test1"].Post.Callbacks["callback1"].Value)["{request.body#/callback}"].Post.RequestBody.Value.Content["application/json"].Schema.Value)
require.NotNil(t, (*doc.Paths["/test2"].Post.Callbacks["callback2"].Value)["{request.body#/callback}"].Post.RequestBody.Value.Content["application/json"].Schema.Value)
}
openapi: 3.0.0
info:
version: 0.0.1
title: 'test'
paths:
/test1:
post:
requestBody:
content:
application/json:
schema:
type: object
responses:
'200':
description: 'test'
callbacks:
callback1:
'{request.body#/callback}':
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/test'
responses:
'200':
description: 'test'
/test2:
post:
requestBody:
content:
application/json:
schema:
type: object
responses:
'200':
description: 'test'
callbacks:
callback2:
'{request.body#/callback}':
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/test'
responses:
'200':
description: 'test'
components:
schemas:
test:
type: string
Metadata
Metadata
Assignees
Labels
No labels