I have the following Swagger definitions:
**NumberString.yaml**
type: string
pattern: ^d*.?d+$
**Bank.yaml**
type: object
properties:
bank_account_number:
allOf:
- $ref: '../../Helpers/NumberString.yaml'
- description: 'Bank Account Number'
example: '337612234'
maxLength: 9
NumberString represents a string that can only be a number; that’s why I have the digit pattern. Then, I have defined a Bank schema.
Have I defined bank_account_number correctly?
I am trying to ‘extend’ the NumberString schema, adding a maxLength, description and example.
New contributor
Shahram is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.