FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
postgrest-openapi/sql/openapi.sql at main · laurenceisla/postgrest-openapi · GitHub
laurenceisla
/
postgrest-openapi
Public
forked from
PostgREST/postgrest-openapi
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
postgrest-openapi
/
sql
/
openapi.sql
Copy path
More file actions
More file actions
Latest commit
History
History
History
180 lines (174 loc) · 4.5 KB
Breadcrumbs
postgrest-openapi
/
sql
/
openapi.sql
Copy path
File metadata and controls
180 lines (174 loc) · 4.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
--
Functions to build the the OpenAPI output
create or replace
function
openapi_object
(
openapi
text
,
info jsonb,
paths jsonb,
jsonSchemaDialect
text
default
null
,
servers jsonb default
null
,
webhooks jsonb default
null
,
components jsonb default
null
,
security jsonb default
null
,
tags jsonb default
null
,
externalDocs jsonb default
null
)
returns jsonb language sql
as
$$
select
jsonb_strip_nulls(
jsonb_build_object(
'
openapi
'
, openapi,
'
info
'
, info,
'
paths
'
, paths,
'
jsonSchemaDialect
'
, jsonSchemaDialect,
'
servers
'
, servers,
'
webhooks
'
, webhooks,
'
components
'
, components,
'
security
'
, security,
'
tags
'
, tags,
'
externalDocs
'
, externalDocs
)
);
$$;
create or replace
function
openapi_server_object
(
url
text
,
description
text
default
null
,
variables jsonb default
null
)
returns jsonb language sql
as
$$
select
jsonb_build_object(
'
url
'
, url,
'
description
'
, description,
'
variables
'
, variables
)
$$;
create or replace
function
openapi_info_object
(
title
text
,
version
text
,
summary
text
default
null
,
description
text
default
null
,
termsOfService
text
default
null
,
contact jsonb default
null
,
license jsonb default
null
)
returns jsonb language sql
as
$$
select
jsonb_build_object(
'
title
'
, title,
'
version
'
, version,
'
summary
'
, summary,
'
description
'
, description,
'
termsOfService
'
, termsOfService,
'
contact
'
, contact,
'
license
'
, license
);
$$;
create or replace
function
openapi_components_object
(
schemas jsonb default
null
,
responses jsonb default
null
,
parameters jsonb default
null
,
examples jsonb default
null
,
requestBodies jsonb default
null
,
headers jsonb default
null
,
securitySchemes jsonb default
null
,
links jsonb default
null
,
callbacks jsonb default
null
,
pathItems jsonb default
null
)
returns jsonb language sql
as
$$
select
json_build_object(
'
schemas
'
, schemas,
'
responses
'
, responses,
'
parameters
'
, parameters,
'
examples
'
, examples,
'
requestBodies
'
, requestBodies,
'
headers
'
, headers,
'
securitySchemes
'
, securitySchemes,
'
links
'
, links,
'
callbacks
'
, callbacks,
'
pathItems
'
, pathItems
);
$$;
create or replace
function
openapi_schema_object
(
title
text
default
null
,
description
text
default
null
,
enum jsonb default
null
,
"
default
"
text
default
null
,
format
text
default
null
,
type
text
default
null
,
items jsonb default
null
,
maxItems
integer
default
null
,
minItems
integer
default
null
,
uniqueItems
boolean
default
null
,
pattern
text
default
null
,
maxLength
integer
default
null
,
minLength
integer
default
null
,
maximum
numeric
default
null
,
exclusiveMaximum
boolean
default
null
,
minimum
numeric
default
null
,
exclusiveMinimum
boolean
default
null
,
multipleOf
numeric
default
null
,
required
text
[] default
null
,
properties jsonb default
null
,
additionalProperties jsonb default
null
,
maxProperties
integer
default
null
,
minProperties
integer
default
null
,
allOf jsonb default
null
,
oneOf jsonb default
null
,
anyOf jsonb default
null
,
"
not
"
jsonb default
null
,
discriminator jsonb default
null
,
readOnly
boolean
default
null
,
writeOnly
boolean
default
null
,
xml jsonb default
null
,
externalDocs jsonb default
null
,
example jsonb default
null
,
deprecated
boolean
default
null
)
returns jsonb language sql
as
$$
--
TODO: build the JSON object according to the type
select
jsonb_build_object(
'
title
'
, title,
'
description
'
, description,
'
enum
'
, enum,
'
default
'
,
"
default
"
,
'
format
'
, format,
'
type
'
, type,
'
items
'
, items,
'
maxItems
'
, maxItems,
'
minItems
'
, minItems,
'
uniqueItems
'
, uniqueItems,
'
pattern
'
, pattern,
'
maxLength
'
, maxLength,
'
minLength
'
, minLength,
'
maximum
'
, maximum,
'
exclusiveMaximum
'
, exclusiveMaximum,
'
minimum
'
, minimum,
'
exclusiveMinimum
'
, exclusiveMinimum,
'
multipleOf
'
, multipleOf,
'
required
'
, required,
'
properties
'
, properties,
'
additionalProperties
'
, additionalProperties,
'
maxProperties
'
, maxProperties,
'
minProperties
'
, minProperties,
'
allOf
'
, allOf,
'
oneOf
'
, oneOf,
'
anyOf
'
, anyOf,
'
not
'
,
"
not
"
,
'
discriminator
'
, discriminator,
'
readOnly
'
, readOnly,
'
writeOnly
'
, writeOnly,
'
xml
'
, xml,
'
externalDocs
'
, externalDocs,
'
example
'
, example,
'
deprecated
'
, deprecated
)
$$;
create or replace
function
openapi_build_ref
(ref
text
)
returns jsonb language sql
as
$$
select
json_build_object(
'
$ref
'
,
'
#/components/schemas/
'
||
ref
);
$$;
Back
|
FazBrowse Home
|
New Git URL