Skip to content

Commit

Permalink
Reference types resolver bug (airtasker#183)
Browse files Browse the repository at this point in the history
Removed root level reference type parsing optimisation which fixes root level complex type parsing bug.
  • Loading branch information
lfportal authored Apr 11, 2019
1 parent 723a86d commit 75a5526
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 361 deletions.
86 changes: 43 additions & 43 deletions lib/src/generators/contract/__snapshots__/json-schema.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,32 @@ exports[`JSON Schema generator produces valid code: json 1`] = `
\\"data\\"
]
},
\\"Profile\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"private\\": {
\\"type\\": \\"boolean\\"
},
\\"messageOptions\\": {
\\"$ref\\": \\"#/definitions/MessageOptions\\"
}
},
\\"required\\": [
\\"private\\",
\\"messageOptions\\"
]
},
\\"MessageOptions\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"newsletter\\": {
\\"type\\": \\"boolean\\"
}
},
\\"required\\": [
\\"newsletter\\"
]
},
\\"ErrorBody\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
Expand Down Expand Up @@ -84,32 +110,6 @@ exports[`JSON Schema generator produces valid code: json 1`] = `
\\"data\\"
]
},
\\"Profile\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"private\\": {
\\"type\\": \\"boolean\\"
},
\\"messageOptions\\": {
\\"$ref\\": \\"#/definitions/MessageOptions\\"
}
},
\\"required\\": [
\\"private\\",
\\"messageOptions\\"
]
},
\\"MessageOptions\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"newsletter\\": {
\\"type\\": \\"boolean\\"
}
},
\\"required\\": [
\\"newsletter\\"
]
},
\\"Email\\": {
\\"type\\": \\"string\\"
},
Expand Down Expand Up @@ -141,6 +141,23 @@ definitions:
- profile
required:
- data
Profile:
type: object
properties:
private:
type: boolean
messageOptions:
$ref: '#/definitions/MessageOptions'
required:
- private
- messageOptions
MessageOptions:
type: object
properties:
newsletter:
type: boolean
required:
- newsletter
ErrorBody:
type: object
properties:
Expand Down Expand Up @@ -177,23 +194,6 @@ definitions:
- address
required:
- data
Profile:
type: object
properties:
private:
type: boolean
messageOptions:
$ref: '#/definitions/MessageOptions'
required:
- private
- messageOptions
MessageOptions:
type: object
properties:
newsletter:
type: boolean
required:
- newsletter
Email:
type: string
Address:
Expand Down
150 changes: 75 additions & 75 deletions lib/src/generators/contract/__snapshots__/openapi2.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ exports[`OpenAPI 2 generator produces valid code: json 1`] = `
}
},
\\"definitions\\": {
\\"UserBody\\": {
\\"Address\\": {
\\"type\\": \\"string\\"
},
\\"CreateUserRequestBody\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"data\\": {
Expand All @@ -157,21 +160,32 @@ exports[`OpenAPI 2 generator produces valid code: json 1`] = `
\\"lastName\\": {
\\"type\\": \\"string\\"
},
\\"profile\\": {
\\"$ref\\": \\"#/definitions/Profile\\"
\\"age\\": {
\\"type\\": \\"number\\"
},
\\"email\\": {
\\"$ref\\": \\"#/definitions/Email\\"
},
\\"address\\": {
\\"$ref\\": \\"#/definitions/Address\\"
}
},
\\"required\\": [
\\"firstName\\",
\\"lastName\\",
\\"profile\\"
\\"age\\",
\\"email\\",
\\"address\\"
]
}
},
\\"required\\": [
\\"data\\"
]
},
\\"Email\\": {
\\"type\\": \\"string\\"
},
\\"ErrorBody\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
Expand All @@ -190,39 +204,15 @@ exports[`OpenAPI 2 generator produces valid code: json 1`] = `
\\"message\\"
]
},
\\"CreateUserRequestBody\\": {
\\"MessageOptions\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"data\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"firstName\\": {
\\"type\\": \\"string\\"
},
\\"lastName\\": {
\\"type\\": \\"string\\"
},
\\"age\\": {
\\"type\\": \\"number\\"
},
\\"email\\": {
\\"$ref\\": \\"#/definitions/Email\\"
},
\\"address\\": {
\\"$ref\\": \\"#/definitions/Address\\"
}
},
\\"required\\": [
\\"firstName\\",
\\"lastName\\",
\\"age\\",
\\"email\\",
\\"address\\"
]
\\"newsletter\\": {
\\"type\\": \\"boolean\\"
}
},
\\"required\\": [
\\"data\\"
\\"newsletter\\"
]
},
\\"Profile\\": {
Expand All @@ -240,22 +230,32 @@ exports[`OpenAPI 2 generator produces valid code: json 1`] = `
\\"messageOptions\\"
]
},
\\"MessageOptions\\": {
\\"UserBody\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"newsletter\\": {
\\"type\\": \\"boolean\\"
\\"data\\": {
\\"type\\": \\"object\\",
\\"properties\\": {
\\"firstName\\": {
\\"type\\": \\"string\\"
},
\\"lastName\\": {
\\"type\\": \\"string\\"
},
\\"profile\\": {
\\"$ref\\": \\"#/definitions/Profile\\"
}
},
\\"required\\": [
\\"firstName\\",
\\"lastName\\",
\\"profile\\"
]
}
},
\\"required\\": [
\\"newsletter\\"
\\"data\\"
]
},
\\"Email\\": {
\\"type\\": \\"string\\"
},
\\"Address\\": {
\\"type\\": \\"string\\"
}
},
\\"securityDefinitions\\": {
Expand Down Expand Up @@ -373,7 +373,9 @@ paths:
headers: {}
description: ''
definitions:
UserBody:
Address:
type: string
CreateUserRequestBody:
type: object
properties:
data:
Expand All @@ -383,14 +385,22 @@ definitions:
type: string
lastName:
type: string
profile:
$ref: '#/definitions/Profile'
age:
type: number
email:
$ref: '#/definitions/Email'
address:
$ref: '#/definitions/Address'
required:
- firstName
- lastName
- profile
- age
- email
- address
required:
- data
Email:
type: string
ErrorBody:
type: object
properties:
Expand All @@ -403,30 +413,13 @@ definitions:
required:
- name
- message
CreateUserRequestBody:
MessageOptions:
type: object
properties:
data:
type: object
properties:
firstName:
type: string
lastName:
type: string
age:
type: number
email:
$ref: '#/definitions/Email'
address:
$ref: '#/definitions/Address'
required:
- firstName
- lastName
- age
- email
- address
newsletter:
type: boolean
required:
- data
- newsletter
Profile:
type: object
properties:
Expand All @@ -437,17 +430,24 @@ definitions:
required:
- private
- messageOptions
MessageOptions:
UserBody:
type: object
properties:
newsletter:
type: boolean
data:
type: object
properties:
firstName:
type: string
lastName:
type: string
profile:
$ref: '#/definitions/Profile'
required:
- firstName
- lastName
- profile
required:
- newsletter
Email:
type: string
Address:
type: string
- data
securityDefinitions:
securityHeader:
type: apiKey
Expand Down
Loading

0 comments on commit 75a5526

Please sign in to comment.