forked from oapi-codegen/oapi-codegen
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.yaml
More file actions
67 lines (67 loc) · 2.73 KB
/
api.yaml
File metadata and controls
67 lines (67 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
openapi: "3.0.0"
info:
version: 1.0.0
title: prefer-skip-optional-pointer
components:
schemas:
Client:
type: object
required:
- name
properties:
name:
description: This field is required, so will never have an optional pointer.
type: string
id:
description: This field is optional, but the `prefer-skip-optional-pointer` Output Option ensures that this should not have an optional pointer.
type: number
ClientWithExtension:
type: object
required:
- name
properties:
name:
description: This field is required, so will never have an optional pointer.
type: string
id:
description: This field is optional, but the `prefer-skip-optional-pointer` Output Option ensures that this should not have an optional pointer.
type: number
pointer_id:
type: number
description: This field should have an optional pointer, as the field-level definition of `x-go-type-skip-optional-pointer` overrides the `prefer-skip-optional-pointer` Output Option.
# NOTE that this overrides the global preference
x-go-type-skip-optional-pointer: false
NestedType:
type: object
properties:
client:
description: This field is optional, but the `prefer-skip-optional-pointer` Output Option ensures that this should not have an optional pointer.
$ref: '#/components/schemas/Client'
ReferencesATypeWithAnExtensionInsideAllOf:
type: object
description: This type has a field which references - via an `allOf` - a type which should have an optional pointer, as the field-level definition of `x-go-type-skip-optional-pointer` overrides the `prefer-skip-optional-pointer` Output Option, as well as a field without that property.
additionalProperties: false
required:
- description
properties:
noExtension:
# NOTE this will not generate pointer type as global preference `prefer-skip-optional-pointer: true`
allOf:
- $ref: '#/components/schemas/ReferencedWithoutExtension'
withExtensionPointer:
# NOTE this will generate pointer type (despite global preference `prefer-skip-optional-pointer: true`) as we have field-level `x-go-type-skip-optional-pointer: false`
allOf:
- $ref: '#/components/schemas/ReferencedWithExtension'
ReferencedWithoutExtension:
type: object
additionalProperties: false
properties:
foo:
type: string
ReferencedWithExtension:
type: object
additionalProperties: false
properties:
foo:
type: string
x-go-type-skip-optional-pointer: false