Skip to content

Commit

Permalink
fix(vadliation): example property (#10)
Browse files Browse the repository at this point in the history
* fix(vadliation): example property

fix #9

* docs(github): add playground url in bug report
  • Loading branch information
Himenon committed Jan 16, 2021
1 parent 9b3db50 commit c25ddac
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
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

0 comments on commit c25ddac

Please sign in to comment.