Skip to content

Commit

Permalink
Add more examples of type shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Lucas committed Jun 13, 2024
1 parent 0bbddc1 commit 44aaaa1
Showing 1 changed file with 88 additions and 26 deletions.
114 changes: 88 additions & 26 deletions packages/openapi-ts/test/spec/v3-transforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,75 @@
}
],
"paths": {
"/api/v{api-version}/model-with-date/{id}": {
"/api/model-with-dates": {
"put": {
"tags": ["Complex"],
"operationId": "ComplexParams",
"operationId": "modelWithDates",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json; type=collection": {
"schema": {
"$ref": "#/components/schemas/ModelWithPattern"
"$ref": "#/components/schemas/ModelWithDates"
}
}
}
}
}
}
},
"/api/model-with-dates-array": {
"put": {
"operationId": "modelWithDatesArray",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json; type=collection": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ModelWithDates"
}
}
}
}
}
}
}
},
"/api/array-of-dates": {
"put": {
"operationId": "arrayOfDates",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json; type=collection": {
"schema": {
"type": "array",
"items": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}
}
},
"/api/date": {
"put": {
"operationId": "date",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json; type=collection": {
"schema": {
"type": "string",
"format": "date-time"
}
}
}
Expand All @@ -31,15 +89,13 @@
},
"components": {
"schemas": {
"ModelWithPattern": {
"description": "This is a model that contains a some patterns",
"ModelWithDates": {
"description": "This is a model that contains a some dates",
"type": "object",
"required": ["key", "name"],
"required": ["id", "name", "enabled"],
"properties": {
"key": {
"maxLength": 64,
"pattern": "^[a-zA-Z0-9_]*$",
"type": "string"
"id": {
"type": "number"
},
"name": {
"maxLength": 255,
Expand All @@ -54,25 +110,31 @@
"format": "date-time",
"readOnly": true
},
"id": {
"type": "string",
"pattern": "^\\d{2}-\\d{3}-\\d{4}$"
},
"text": {
"type": "string",
"pattern": "^\\w+$"
},
"patternWithSingleQuotes": {
"expires": {
"type": "string",
"pattern": "^[a-zA-Z0-9']*$"
"format": "date",
"readOnly": true
}
}
},
"ParentModelWithDates": {
"description": "This is a model that contains a some dates and arrays",
"type": "object",
"required": ["id", "name"],
"properties": {
"id": {
"type": "number"
},
"patternWithNewline": {
"modified": {
"type": "string",
"pattern": "aaa\nbbb"
"format": "date-time",
"readOnly": true
},
"patternWithBacktick": {
"type": "string",
"pattern": "aaa`bbb"
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ModelWithDates"
}
}
}
}
Expand Down

0 comments on commit 44aaaa1

Please sign in to comment.