Skip to content

Commit 35cf737

Browse files
committed
Remove obsolete configuration files and restructure OpenAPI documentation
1 parent 1483ac5 commit 35cf737

File tree

21 files changed

+288
-951
lines changed

21 files changed

+288
-951
lines changed

.redocly.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/.redocly.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# See https://redoc.ly/docs/cli/configuration/ for more information.
2+
extends:
3+
- recommended
4+
apis:
5+
core@v1:
6+
root: ./openapi/openapi.yaml
7+
rules:
8+
no-ambiguous-paths: error
9+
theme:
10+
openapi:
11+
hideLogo: false
12+
decorators:
13+
remove-x-internal: on
14+
rules:
15+
no-unused-components: error
16+
operation-singular-tag: warn
17+
boolean-parameter-prefixes:
18+
severity: error
19+
prefixes: ["can", "is", "has"]
20+
theme:
21+
openapi:
22+
schemaExpansionLevel: 2
23+
generateCodeSamples:
24+
languages:
25+
- lang: curl
26+
- lang: Python

docs/index.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<html>
2+
3+
<head>
4+
<!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
5+
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
6+
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css" />
7+
<title>My New API</title>
8+
</head>
9+
10+
<body>
11+
<div id="swagger-ui"></div> <!-- Div to hold the UI component -->
12+
<script>
13+
window.onload = function () {
14+
// Begin Swagger UI call region
15+
const ui = SwaggerUIBundle({
16+
url: 'https://github.com/dan5e3s6ares/nft/blob/docs/docs/openapi.yaml',
17+
dom_id: '#swagger-ui',
18+
deepLinking: true,
19+
presets: [
20+
SwaggerUIBundle.presets.apis,
21+
SwaggerUIBundle.SwaggerUIStandalonePreset
22+
],
23+
plugins: [
24+
SwaggerUIBundle.plugins.DownloadUrl
25+
],
26+
})
27+
window.ui = ui
28+
}
29+
</script>
30+
</body>
31+
32+
</html>

docs/openapi.yaml

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
openapi: 3.0.2
2+
info:
3+
version: 1.0.0
4+
title: NFT Python Floripa
5+
termsOfService: https://example.com/terms/
6+
contact:
7+
8+
url: http://example.com/contact
9+
license:
10+
name: Apache 2.0
11+
url: http://www.apache.org/licenses/LICENSE-2.0.html
12+
x-logo:
13+
url: https://redocly.github.io/openapi-template/logo.png
14+
description: |
15+
This is an **example** API to demonstrate features of OpenAPI specification
16+
# Introduction
17+
This API definition is intended to to be a good starting point for describing your API in
18+
[OpenAPI/Swagger format](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md).
19+
It also demonstrates features of [create-openapi-repo](https://github.com/Redocly/create-openapi-repo) tool and
20+
[Redoc](https://github.com/Redocly/Redoc) documentation engine. So beyond the standard OpenAPI syntax we use a few
21+
[vendor extensions](https://github.com/Redocly/Redoc/blob/master/docs/redoc-vendor-extensions.md).
22+
23+
# OpenAPI Specification
24+
The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which
25+
allows both humans and computers to discover and understand the capabilities of the service without access to source
26+
code, documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can
27+
understand and interact with the remote service with a minimal amount of implementation logic. Similar to what
28+
interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service.
29+
servers:
30+
- url: http://example.com/api/v1
31+
- url: https://example.com/api/v1
32+
tags:
33+
- name: Echo
34+
description: Example echo operations
35+
- name: User
36+
description: Operations about user
37+
externalDocs:
38+
description: Find out how to create a GitHub repo for your OpenAPI definition.
39+
url: https://github.com/Rebilly/generator-openapi-repo
40+
paths:
41+
/users/{username}:
42+
parameters:
43+
- name: pretty_print
44+
in: query
45+
description: Pretty print response
46+
schema:
47+
type: boolean
48+
get:
49+
tags:
50+
- User
51+
summary: Get user by user name
52+
description: |
53+
Some description of the operation.
54+
You can use `markdown` here.
55+
operationId: getUserByName
56+
parameters:
57+
- name: username
58+
in: path
59+
description: The name that needs to be fetched
60+
required: true
61+
schema:
62+
type: string
63+
- name: with_email
64+
in: query
65+
description: Filter users without email
66+
schema:
67+
type: boolean
68+
security:
69+
- main_auth:
70+
- read:users
71+
- api_key: []
72+
responses:
73+
'200':
74+
description: Success
75+
content:
76+
application/json:
77+
schema:
78+
$ref: '#/components/schemas/User'
79+
example:
80+
username: user1
81+
82+
'403':
83+
description: Forbidden
84+
'404':
85+
description: User not found
86+
put:
87+
tags:
88+
- User
89+
summary: Updated user
90+
description: This can only be done by the logged in user.
91+
operationId: updateUser
92+
parameters:
93+
- name: username
94+
in: path
95+
description: The name that needs to be updated
96+
required: true
97+
schema:
98+
type: string
99+
security:
100+
- main_auth:
101+
- write:users
102+
responses:
103+
'200':
104+
description: OK
105+
'400':
106+
description: Invalid user supplied
107+
'404':
108+
description: User not found
109+
requestBody:
110+
content:
111+
application/json:
112+
schema:
113+
$ref: '#/components/schemas/User'
114+
application/xml:
115+
schema:
116+
$ref: '#/components/schemas/User'
117+
description: Updated user object
118+
required: true
119+
/echo:
120+
post:
121+
tags:
122+
- Echo
123+
summary: Echo test
124+
description: Receive the exact message you've sent
125+
operationId: echo
126+
security:
127+
- api_key: []
128+
- basic_auth: []
129+
responses:
130+
'200':
131+
description: OK
132+
headers:
133+
X-Rate-Limit:
134+
description: calls per hour allowed by the user
135+
schema:
136+
type: integer
137+
format: int32
138+
X-Expires-After:
139+
$ref: '#/components/headers/ExpiresAfter'
140+
content:
141+
application/json:
142+
schema:
143+
type: string
144+
examples:
145+
response:
146+
value: Hello world!
147+
application/xml:
148+
schema:
149+
type: string
150+
text/csv:
151+
schema:
152+
type: string
153+
requestBody:
154+
content:
155+
application/json:
156+
schema:
157+
type: string
158+
example: Hello world!
159+
application/xml:
160+
schema:
161+
type: string
162+
example: Hello world!
163+
description: Echo payload
164+
required: true
165+
components:
166+
securitySchemes:
167+
main_auth:
168+
type: oauth2
169+
flows:
170+
implicit:
171+
authorizationUrl: http://example.com/api/oauth/dialog
172+
scopes:
173+
read:users: read users info
174+
write:users: modify or remove users
175+
api_key:
176+
type: apiKey
177+
in: header
178+
name: api_key
179+
basic_auth:
180+
type: http
181+
scheme: basic
182+
schemas:
183+
Email:
184+
description: User email address
185+
type: string
186+
format: test
187+
188+
User:
189+
type: object
190+
properties:
191+
username:
192+
description: User supplied username
193+
type: string
194+
minLength: 4
195+
example: John78
196+
firstName:
197+
description: User first name
198+
type: string
199+
minLength: 1
200+
example: John
201+
lastName:
202+
description: User last name
203+
type: string
204+
minLength: 1
205+
example: Smith
206+
email:
207+
$ref: '#/components/schemas/Email'
208+
headers:
209+
ExpiresAfter:
210+
description: date in UTC when token expires
211+
schema:
212+
type: string
213+
format: date-time
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)