Skip to content

Commit 0cffd38

Browse files
committed
fix: minor documentation improvements
1 parent 7bca6f2 commit 0cffd38

File tree

2 files changed

+57
-75
lines changed

2 files changed

+57
-75
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Red Hat Application Services API Guidelines
22

3-
This repo will contain website documentation for API guidelines and tooling to help adhere to the guidelines.
3+
RHOAS (application services) API guidelines based on OpenAPI and Spectral tooling.
44

5-
## API Standards
5+
## RHOAS API Standards
66

7-
[Api Standards documentation](./docs/api-standards.md)
7+
[Api Standards](./docs/api-standards.md)
88

9-
## OpenAPI Validation
9+
## Tooling for validation of API Standards
1010

1111
[API Validator documentation](./spectral) helps to ensure that your specification meets all standards.

docs/api-standards.md

Lines changed: 53 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,49 @@ This document is intended as a collaborative document to agree and define standa
55

66
## Versioning
77

8-
98
* Set the version number in the _info.version_ field.
109
* The version should follow [Semantic Versioning](https://semver.org/).
11-
* A **MAJOR** version change is required when you make incompatible API changes.
12-
* Removal of an endpoint.
13-
* Changes to an endpoint URI structure.
14-
* Modifying a schema object such as a request or response payload object.
15-
* Removal of a query parameter.
16-
* Making a non-required parameter required.
17-
* Modifying a field name.
18-
* Modifying authorization.
19-
* Introducing rate-limiting.
20-
* Removal of a field
21-
* Addition of a required field in the request object
22-
* Addition of validation that was not present before
23-
* A **MINOR **version change is required when an additive change is made to the OpenAPI document.
24-
* Adding an endpoint.
25-
* Adding optional query parameters.
26-
* Adding optional fields to a schema used in a request payload.
27-
* Adding a response field.
28-
* A **PATCH **version change is required when a change which fixes broken functionality of the schema.
29-
* Invalid reference to a schema object
30-
* Typo in a property such as a tag
31-
* Errors in the document itself, such as a string that is not closed.
32-
* A pre-release extension may be added to indicate that the API version is unstable. For example: 2.0.0-alpha1.
10+
* A **MAJOR** version change is required when you make incompatible API changes.
11+
* Removal of an endpoint.
12+
* Changes to an endpoint URI structure.
13+
* Modifying a schema object such as a request or response payload object.
14+
* Removal of a query parameter.
15+
* Making a non-required parameter required.
16+
* Modifying a field name.
17+
* Modifying authorization.
18+
* Introducing rate-limiting.
19+
* Removal of a field
20+
* Addition of a required field in the request object
21+
* Addition of validation that was not present before
22+
* A **MINOR**version change is required when an additive change is made to the OpenAPI document.
23+
* Adding an endpoint.
24+
* Adding optional query parameters.
25+
* Adding optional fields to a schema used in a request payload.
26+
* Adding a response field.
27+
* A **PATCH**version change is required when a change which fixes broken functionality of the schema.
28+
* Invalid reference to a schema object
29+
* Typo in a property such as a tag
30+
* Errors in the document itself, such as a string that is not closed.
31+
* A pre-release extension may be added to indicate that the API version is unstable. For example: 2.0.0-alpha1.
3332
* APIs must not expose the minor or patch version in the API URL.
34-
* For releases which have alpha or beta stability the API **must** append the stability level after the major version using _[Channel-based versioning](https://cloud.google.com/apis/design/versioning). _For example: **v1beta**, **v2alpha**.
33+
* For releases which have alpha or beta stability the API **must** append the stability level after the major version using _[Channel-based versioning](https://cloud.google.com/apis/design/versioning)._For example: **v1beta**, **v2alpha**.
3534
* All resource endpoints must include the channel version; `/v1`, `/v2`, `v2beta` etc.
36-
* /api/srs_mgmt/v1/registries
37-
* /api/kafka_mgmt/v1/kafkas
38-
* /api/kafka_mgmt/v2beta/kafkas
35+
* /api/srs_mgmt/v1/registries
36+
* /api/kafka_mgmt/v1/kafkas
37+
* /api/kafka_mgmt/v2beta/kafkas
3938
* The name of the OpenAPI file should include the version using the following format: \
4039
“${service_or_api_name}.{yaml | json}”. Some examples:
41-
* kas-fleet-manager.yaml
42-
* srs-fleet-manager.json
43-
* kafka-admin-api.yaml
44-
40+
* kas-fleet-manager.yaml
41+
* srs-fleet-manager.json
42+
* kafka-admin-api.yaml
4543

4644
## Rules
4745

48-
49-
5046
* Should use OpenAPI v3+
5147
* `info.license` must be Apache 2.0
5248
* Every endpoint must have an _operationId_ specified.
5349
* The `servers` config array is required for control plane APIs and should look as follows: \
5450

55-
5651
```yaml
5752
servers:
5853
- url: https://api.openshift.com
@@ -65,23 +60,19 @@ servers:
6560
description: current domain
6661
```
6762
68-
6963
* Examples should be provided where possible/appropriate for documentation purposes.
7064
71-
7265
## Naming
7366
74-
7567
### API Paths
7668
77-
API endpoints should use _snake_case _for word separation.
69+
API endpoints should use _snake_case_for word separation.
7870
7971
Examples:
8072
8173
* /cloud_providers/..
8274
* /service_accounts/../reset_credentials
8375
84-
8576
### Fields
8677
8778
Fields should use _snake_case_ for word separation.
@@ -91,45 +82,41 @@ Examples:
9182
* cloud_provider_region
9283
* bootstrap_server_host
9384
94-
9585
### Operations
9686
97-
The **operationId **will be used to name methods in the API clients. As such, changes to the names should be treated as breaking changes, and so we should be careful and explicit with our naming of them.
98-
87+
The **operationId**will be used to name methods in the API clients. As such, changes to the names should be treated as breaking changes, and so we should be careful and explicit with our naming of them.
9988
100-
* **get{Resource}By{Argument} **- get a single Resource
101-
* getKafkaById
102-
* getRegistryById
103-
* getServiceAccountById
104-
* getTopicByName
89+
* **get{Resource}By{Argument}**- get a single Resource
90+
* getKafkaById
91+
* getRegistryById
92+
* getServiceAccountById
93+
* getTopicByName
10594
* **get{Resources}** - get multiple Resources
106-
* getRegistries
107-
* getKafkas
108-
* getServiceAccounts
109-
* getTopics
95+
* getRegistries
96+
* getKafkas
97+
* getServiceAccounts
98+
* getTopics
11099
* **delete{Resource}?By{Arg}** - Delete a single resource or multiple resources
111-
* deleteKafkaById
112-
* deleteTopicByName
113-
* deleteTopics
114-
* deleteRegistryById
100+
* deleteKafkaById
101+
* deleteTopicByName
102+
* deleteTopics
103+
* deleteRegistryById
115104
* **update{Resource}?By{Argument}** - update a resource or multiple resources
116-
* updateKafkaById
117-
* updateKafkaByName
118-
* updateRegistryById
119-
* updateTopics
105+
* updateKafkaById
106+
* updateKafkaByName
107+
* updateRegistryById
108+
* updateTopics
120109
* **create{Resource}**- create a resource
121-
* createKafka
122-
* createRegistry
123-
* createTopic
124-
110+
* createKafka
111+
* createRegistry
112+
* createTopic
125113
126114
## Security
127115
128-
The following security scheme **must** be added to the OpenAPI document.
116+
The following security scheme **must** be added to the OpenAPI document.
129117
130118
Depending on your API this can be applied globally, or per endpoint.
131119
132-
133120
```yaml
134121
# 1) Define the security scheme type (HTTP bearer)
135122
components:
@@ -143,29 +130,24 @@ security:
143130
- bearer: [] # use the same name as above
144131
```
145132
146-
147-
148133
## Tags
149134
150135
Grouping operations with tags is a good practice and is recommended.
151136
152137
If tags are used a root level global “tags” section should be defined matching those used in operations.
153138
154-
155139
## Schemas
156140
157141
There are a number of schemas which should be common across all managed service APIs.
158142
159143
_Note: This list is incomplete._
160144
161-
162145
### Error
163146
164147
[Error](https://github.com/redhat-developer/app-services-api-guidelines/tree/main/spectral#rhoas-error-schema)
165148
166-
167149
### List
168150
169151
[List](https://github.com/redhat-developer/app-services-api-guidelines/tree/main/spectral#rhoas-list-schema)
170152
171-
This would mean enforcing page/total/size pagination on lists.
153+
This would mean enforcing page/total/size pagination on lists.

0 commit comments

Comments
 (0)