As described in the OpenAPI documentation properties next to a $ref
should be ignored.
However there is not really any way around this for certain things specially around describing properties of a definition vs the definition itself.
That's why autorest
does support a set of properties next to a $ref
. Using different ones will log a warning and will have them be ignored.
Can be used to provide a description on a schema/definition property.
schemas:
Foo:
myProp:
$ref: "#/components/schemas/Bar"
description: "This is a description for myProp"
Can be used to provide a title on a schema/definition property.
schemas:
Foo:
myProp:
$ref: "#/components/schemas/Bar"
title: "This is a title for myProp"
Can be used to mark a property as readonly.
schemas:
Foo:
myProp:
$ref: "#/components/schemas/Bar"
readonly: true
Can be used to mark a property as nullable.
schemas:
Foo:
myProp:
$ref: "#/components/schemas/Bar"
nullable: true
Can be used to change the property name in the resulting SDK
schemas:
Foo:
myProp:
$ref: "#/components/schemas/Bar"
x-ms-client-name: myMoreMeaningfulProp
Any custom extension will also be allowed and pass through to the SDK codemodel.
schemas:
Foo:
myProp:
$ref: "#/components/schemas/Bar"
x-my-custom-value: "something"