Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions spec/test_cases/dynamic-ref.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
- description: Modeling generics with $dynamicRef and $dynamicAnchor as in https://json-schema.org/blog/posts/dynamicref-and-generics
oad:
openapi: 3.1.0
paths:
"/strings":
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ListOfString'
responses:
'200':
description: ok
content:
application/json:
schema:
$ref: '#/components/schemas/ListOfString'
components:
schemas:
ListOfT:
$id: 'https://json-schema.blog/list-of-t'
$defs:
content:
$dynamicAnchor: T
not: true
type: array
items:
$dynamicRef: '#T'
ListOfString:
$defs:
string-items:
$dynamicAnchor: T
type: string
$ref: '#/components/schemas/ListOfT'
valid_response:
content_type: application/json
body: ["hello", "world"]
invalid_response:
content_type: application/json
body: [1, 2, 3]
valid_request:
method: post
uri: "/strings"
body: ["hello", "world"]
invalid_request:
method: post
uri: "/strings"
body: [1, 2, 3]
Loading