-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
From the OpenAPI specification files, there are multiple entries of the exact same definition.
For example, for unique identifier we have this in almost every parameter, path, request and response:
"tenantId": {
"description": "The object ID of the tenant to operate against.",
"in": "path",
"name": "tenantId",
"required": true,
"schema": {
"examples": ["b2fd105a-2594-437e-b934-1a62a51c28b4"],
"format": "uuid",
"maxLength": 36,
"minLength": 36,
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$",
"type": "string"
},To save maintenance and modification pain we can define the UUID type in ``components.schemaand then reuse it via$ref`, similar to `SecurityClass` definition.
"components" {
"schemas": {
"uuid": {
"examples": ["b2fd105a-2594-437e-b934-1a62a51c28b4"],
"format": "uuid",
"maxLength": 36,
"minLength": 36,
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$",
"type": "string"
}
}
}then reuse it elsewhere:
"tenantId": {
"description": "The object ID of the tenant to operate against.",
"in": "path",
"name": "tenantId",
"required": true,
"schema": {
"$ref": "#/components/schemas/uuid"
}
}By using this approach for all the common types it will save us hundreds to thousands lines from both specification json files plus avoiding subtle, hard to detect human errors during modification.
elliot-huffman
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested