Forum Discussion
HKosova
Alumni
7 years agoHi SteMMo,
This is not possible in OpenAPI 2.0 - you'll need to refine the DeviceID type inline both in the path parameter and in the body parameter schema.
However, this is possible in OpenAPI 3.0 should you decide to convert your definition to the new spec version.
openapi: 3.0.0
...
paths:
/root/{deviceId}/config:
post:
parameters:
- in: path
name: deviceId
required: true
schema:
$ref: '#/components/schemas/DeviceID'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RequestBodySchema'
responses:
'200':
description: OK
components:
schemas:
DeviceID:
type: string
description: Generato a partire dal MAC address
example: AABBCCEE
RequestBodySchema:
type: object
properties:
deviceID:
$ref: '#/components/schemas/DeviceID'
...