Skip to content

Commit

Permalink
airtasker#1417 Add new unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thodin3 committed May 11, 2021
1 parent 1fcb18f commit 2c692ad
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ exports[`OpenAPI 2 generator schemaprops contract with schemaprops parses correc
],
\\"minProperties\\": 1,
\\"maxProperties\\": 100,
\\"example\\": {
\\"price\\": 3.14
},
\\"description\\": \\"property-schemaprop description for object\\"
},
\\"currencies\\": {
Expand All @@ -955,6 +958,7 @@ exports[`OpenAPI 2 generator schemaprops contract with schemaprops parses correc
\\"APPROVED\\"
],
\\"title\\": \\"process-code\\",
\\"example\\": \\"WAITING\\",
\\"description\\": \\"property-schemaprop description for union\\"
},
\\"inheritance\\": {
Expand Down Expand Up @@ -992,6 +996,10 @@ exports[`OpenAPI 2 generator schemaprops contract with schemaprops parses correc
}
],
\\"title\\": \\"process-code\\",
\\"example\\": {
\\"inheritId\\": 3.14,
\\"inheritName\\": 42
},
\\"description\\": \\"property-schemaprop description for intersection\\"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class EndpointWithSchemaPropsOnHeaders {
* 1
* @oaSchemaProp maxProperties
* 100
* @oaSchemaProp example
* {"price":3.14}
* */
element: {
/** property-schemaprop description for float inner object
Expand All @@ -83,11 +85,15 @@ class EndpointWithSchemaPropsOnHeaders {
/** property-schemaprop description for union
* @oaSchemaProp title
* "process-code"
* @oaSchemaProp example
* "WAITING"
* */
code?: "VALID" | "NOT_VALID" | "WAITING" | "APPROVED";
/** property-schemaprop description for intersection
* @oaSchemaProp title
* "process-code"
* @oaSchemaProp example
* {"inheritId":3.14, "inheritName":42}
* */
inheritance?: {
/** property-schemaprop description for double inner intersection
Expand Down
6 changes: 6 additions & 0 deletions lib/src/generators/openapi2/openapi2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ describe("OpenAPI 2 generator", () => {
description: "property-schemaprop description for object",
maxProperties: 100,
minProperties: 1,
example: { price: 3.14 },
properties: {
price: {
description:
Expand Down Expand Up @@ -366,6 +367,7 @@ describe("OpenAPI 2 generator", () => {
description: "property-schemaprop description for union",
enum: ["VALID", "NOT_VALID", "WAITING", "APPROVED"],
title: "process-code",
example: "WAITING",
type: "string"
},
inheritance: {
Expand Down Expand Up @@ -400,6 +402,10 @@ describe("OpenAPI 2 generator", () => {
type: "object"
}
],
example: {
inheritId: 3.14,
inheritName: 42
},
description:
"property-schemaprop description for intersection",
title: "process-code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,9 @@ exports[`OpenAPI 3 generator schemaprops contract with schemaprops parses correc
\\"minProperties\\": 1,
\\"maxProperties\\": 100,
\\"additionalProperties\\": true,
\\"example\\": {
\\"price\\": 3.14
},
\\"description\\": \\"property-schemaprop description for object\\"
},
\\"currencies\\": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class EndpointWithSchemaPropsOnHeaders {
* 100
* @oaSchemaProp additionalProperties
* true
* @oaSchemaProp example
* {"price":3.14}
* */
element: {
/** property-schemaprop description for float inner object
Expand Down
1 change: 1 addition & 0 deletions lib/src/generators/openapi3/openapi3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ describe("OpenAPI 3 generator", () => {
maxProperties: 100,
minProperties: 1,
additionalProperties: true,
example: { price: 3.14 },
properties: {
price: {
description:
Expand Down
2 changes: 1 addition & 1 deletion lib/src/parsers/__spec-examples__/schemaprops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type SchemaPropTests = {
* "property-schemaprop-value"
* */
"property-with-schemaprop": string;
/**
/**
* @oaSchemaProp example
* "123.3"
*/
Expand Down

0 comments on commit 2c692ad

Please sign in to comment.