-
-
Notifications
You must be signed in to change notification settings - Fork 486
Closed
Description
in case of json, there're ways to describe and validate complex structures;
with form-data the same can be achieved - however, currently there's need of properties duplication;
give kin dry spec - it fails
example:
openapi: 3.0.3
info:
version: 1.0.0
title: sample api
description: api service paths to test the issue
paths:
/api/path:
post:
summary: path
tags:
- api
requestBody:
required: true
content:
application/json:
schema: { $ref: '#/components/schemas/PathRequest' }
application/x-www-form-urlencoded:
schema: { $ref: '#/components/schemas/PathRequest' }
responses:
'200':
description: Ok
content:
application/json:
schema: { $ref: '#/components/schemas/PathResponse' }
components:
schemas:
Msg_Opt:
properties:
msg: { type: string }
Msg:
allOf:
- $ref: '#/components/schemas/Msg_Opt'
- required: [ msg ]
Name:
properties:
name: { type: string }
required: [ name ]
Id:
properties:
id:
type: string
format: uint64
required: [ id ]
PathRequest:
type: object
allOf:
- $ref: '#/components/schemas/Msg'
- $ref: '#/components/schemas/Name'
PathResponse:
type: object
allOf:
- $ref: '#/components/schemas/PathRequest'
- $ref: '#/components/schemas/Id'
which fails on msg=message&name=some+name
Metadata
Metadata
Assignees
Labels
No labels