Reputation: 1494
In swagger.yaml swagger: "2.0"
, how do I define a new field let's call it test
which is a string
and have a default value of abc
?
I'm working on a legacy project with many object definitions on the swagger.yaml. This yaml file together with a maven plugin then will produce auto generated java objects.
Just trying to trace one of the auto generated object.
OrganizationResource:
type: "object"
required:
- "data"
properties:
data:
$ref: "#/definitions/Organization"
testa:
type: "string"
value: "abc"
description: "Resource container for Organization"
Upvotes: 1
Views: 861
Reputation: 97677
Use the default
keyword to specify the default values.
test:
type: string
default: abc
Upvotes: 1