-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debug: Test case scenario where definition is missing
Attempt to figure out why the definition is missing on a specific scenario: ``` $ go test -run TestOpenAPI2/typealias --- FAIL: TestOpenAPI2 (0.03s) --- FAIL: TestOpenAPI2/typealias (0.03s) main_test.go:86: incorrect output: swagger: "2.0" info: title: x version: x consumes: - application/json produces: - application/json paths: /path: post: operationId: POST_path consumes: - application/json produces: - application/json parameters: - name: typealias.ReqRef in: body required: true schema: $ref: '#/definitions/typealias.ReqRef' responses: 200: description: 200 OK (no data) definitions: typealias.ReqRef: title: ReqRef description: ReqRef is a request reference. type: object properties: anonymous: type: object properties: alias: type: object additionalProperties: $ref: '#/definitions/typealias.ExampleItem' main_test.go:87: diff --- expected +++ actual @@ -37,13 +37,3 @@ additionalProperties: $ref: '#/definitions/typealias.ExampleItem' - typealias.ExampleItem: - title: ExampleItem - description: ExampleItem is an example item. - type: object - properties: - properties: - field1: - type: string - field2: - type: integer FAIL exit status 1 FAIL github.com/teamwork/kommentaar 1.220s ```
- Loading branch information
1 parent
6b34e3b
commit 2ff59d6
Showing
6 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package typealias | ||
|
||
// ReqRef is a request reference. | ||
type ReqRef struct { | ||
Anonymous struct { | ||
Alias AliasExample `json:"alias,omitempty"` | ||
} `json:"anonymous,omitempty"` | ||
} | ||
|
||
// AliasExample is an example of type alias. | ||
type AliasExample map[string]ExampleItem | ||
|
||
// ExampleItem is an example item. | ||
type ExampleItem struct { | ||
Field1 string `json:"field1"` | ||
Field2 int `json:"field2"` | ||
} | ||
|
||
// POST /path | ||
// | ||
// Request body: ReqRef | ||
// Response 200: {empty} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
swagger: "2.0" | ||
info: | ||
title: x | ||
version: x | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
paths: | ||
/path: | ||
post: | ||
operationId: POST_path | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
parameters: | ||
- name: typealias.ReqRef | ||
in: body | ||
required: true | ||
schema: | ||
$ref: '#/definitions/typealias.ReqRef' | ||
responses: | ||
200: | ||
description: 200 OK (no data) | ||
definitions: | ||
typealias.ReqRef: | ||
title: ReqRef | ||
description: ReqRef is a request reference. | ||
type: object | ||
properties: | ||
anonymous: | ||
type: object | ||
properties: | ||
alias: | ||
type: object | ||
additionalProperties: | ||
$ref: '#/definitions/typealias.ExampleItem' | ||
typealias.ExampleItem: | ||
title: ExampleItem | ||
description: ExampleItem is an example item. | ||
type: object | ||
properties: | ||
properties: | ||
field1: | ||
type: string | ||
field2: | ||
type: integer |