Skip to content

fix(vadliation): example property #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ labels: "Status: Unconfirmed"
-->

<!--
Write the minimum OpenAPI JSON or YAML Schema needed to reproduce the bug.
Write the minimum OpenAPI JSON or YAML Schema needed to reproduce the bug.
If you can reproduce it with the following Playground, please post the URL too.
https://himenon.github.io/openapi-typescript-code-generator-playground/index.html
-->

## The current behavior
Expand Down
2 changes: 1 addition & 1 deletion scripts/testCodeGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const main = () => {
entryPoint: "test/api.test.domain/index.yml",
log: {
validator: {
displayLogLines: 3,
displayLogLines: 1,
},
},
};
Expand Down
21 changes: 20 additions & 1 deletion src/Validator/v3/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,26 @@
"$ref": "#/definitions/externalDocs"
},
"example": {
"$ref": "#/definitions/any"
"oneOf": [
{
"type": "null"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "string"
},
{
"type": "object"
},
{
"type": "array"
}
]
},
"deprecated": {
"type": "boolean"
Expand Down
16 changes: 16 additions & 0 deletions test/api.test.domain/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ components:
StringType:
type: string
description: String Literal
example: "string-type"
StringHasEnumType:
type: string
enum: [a, A, b, B, c, C]
example: "a"
StringDateType:
type: string
format: date
Expand All @@ -47,15 +49,19 @@ components:
NumberHasEnumType:
type: number
enum: [1, 2, 3, 100, 123, 0.1, -0.1, 0.0]
example: -0.1
NumberInt32Type:
type: number
format: int32
example: 12
NumberInt64Type:
type: number
format: int64
example: 64
NumberFloat:
type: number
format: float
example: 3.141592
NumberDouble:
type: number
format: double
Expand All @@ -70,10 +76,12 @@ components:
type: array
items:
type: number
example: [1, 2, 3]
ArrayBooleanType:
type: array
items:
type: boolean
example: [true, false, true]
ObjectEmptyPropertiesType:
type: object
ObjectHasPropertiesType:
Expand All @@ -94,6 +102,14 @@ components:
properties:
requiredStringType:
type: string
example:
{
"stringType": "string-type",
"numberType": 1,
"booleanType": false,
"arrayType": [],
"objectType": { "requiredStringType": "required-string-type" },
}
OneOfType:
oneOf:
- type: string
Expand Down