Skip to content

Commit f36f429

Browse files
committed
docs(repo): update documentation to reflect OpenAPI 3.2 support
1 parent 3c75af5 commit f36f429

4 files changed

Lines changed: 45 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![CircleCI](https://img.shields.io/circleci/build/github/stoplightio/spectral/develop)](https://circleci.com/gh/stoplightio/spectral) [![npm Downloads](https://img.shields.io/npm/dw/@stoplight/spectral-core?color=blue)](https://www.npmjs.com/package/@stoplight/spectral-core) [![Stoplight Forest](https://img.shields.io/ecologi/trees/stoplightinc)][stoplight_forest]
33

44
- **Custom Rulesets**: Create custom rules to lint JSON or YAML objects
5-
- **Ready-to-use Rulesets**: Validate and lint **OpenAPI v2 & v3.x**, **AsyncAPI**, and **Arazzo v1** Documents
5+
- **Ready-to-use Rulesets**: Validate and lint **OpenAPI v2, v3.0, v3.1 & v3.2**, **AsyncAPI**, and **Arazzo v1** Documents
66
- **API Style Guides**: Automated [API Style Guides](https://stoplight.io/api-style-guides-guidelines-and-best-practices?utm_source=github.com&utm_medium=referral&utm_campaign=github_repo_spectral) using rulesets improve consistency across all your APIs
77
- **Ready-to-use Functions**: Built-in set of functions to help [create custom rules](https://meta.stoplight.io/docs/spectral/e5b9616d6d50c-custom-rulesets#adding-rules). Functions include pattern checks, parameter checks, alphabetical ordering, a specified number of characters, provided keys are present in an object, etc.
88
- **Custom Functions**: Create custom functions for advanced use cases

docs/getting-started/4-openapi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Spectral has a built-in [OpenAPI Specification](https://openapis.org/specification) ruleset that you can use to validate your OpenAPI files.
44

5-
Add `extends: "spectral:oas"` ("oas" being shorthand for OpenAPI Specification) to your ruleset file to apply rules for OpenAPI v2 and v3.x, depending on the appropriate OpenAPI version being used (this is automatically detected through [formats](../getting-started/3-rulesets.md#formats)).
5+
Add `extends: "spectral:oas"` ("oas" being shorthand for OpenAPI Specification) to your ruleset file to apply rules for OpenAPI v2, v3.0, v3.1, and v3.2, depending on the appropriate OpenAPI version being used (this is automatically detected through [formats](../getting-started/3-rulesets.md#formats)).
66

77
You can see a full list of the rules in this ruleset in [OpenAPI Rules](../reference/openapi-rules.md).

docs/guides/4-custom-rulesets.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Formats are an optional way to specify which API description formats a rule, or
3737
- `oas3` (OpenAPI v3.x)
3838
- `oas3_0` (OpenAPI v3.0.x)
3939
- `oas3_1` (OpenAPI v3.1.x)
40+
- `oas3_2` (OpenAPI v3.2.x)
4041
- `json-schema` (`$schema` says this is some JSON Schema draft)
4142
- `json-schema-loose` (looks like JSON Schema, but no `$schema` found)
4243
- `json-schema-draft4` (`$schema` says this is JSON Schema Draft 04)

docs/reference/openapi-rules.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In your ruleset file you can add `extends: "spectral:oas"` and you'll get all of
66

77
## OpenAPI v2 & v3
88

9-
These rules apply to both OpenAPI v2.0, v3.0, and most likely v3.1, although there are some differences.
9+
These rules apply to OpenAPI v2.0, v3.0, v3.1, and v3.2, although there are some differences.
1010

1111
### contact-properties
1212

@@ -635,7 +635,7 @@ paths:
635635

636636
## OpenAPI v3-only
637637

638-
These rules will only be applied to OpenAPI v3.0 documents.
638+
These rules will only be applied to OpenAPI v3.0, v3.1, and v3.2 documents.
639639

640640
### oas3-api-servers
641641

@@ -696,7 +696,7 @@ Parameter objects should have a `description`.
696696
### oas3-schema
697697

698698
Validate structure of OpenAPI v3 specification.
699-
If OpenAPI 3.1.0 is used, `jsonSchemaDialect` is not respected and the draft 2020-12 is applied.
699+
If OpenAPI 3.1 or 3.2 is used, `jsonSchemaDialect` is not respected and the draft 2020-12 is applied.
700700
If you define your own `jsonSchemaDialect`, you'll most likely want to disable this rule.
701701

702702
**Recommended:** Yes
@@ -880,7 +880,7 @@ schemas:
880880

881881
### oas3-server-variables
882882

883-
This rule ensures that server variables defined in OpenAPI Specification 3 (OAS3) and 3.1 are valid, not unused, and result in a valid URL. Properly defining and using server variables is crucial for the accurate representation of API endpoints and preventing potential misconfigurations or security issues.
883+
This rule ensures that server variables defined in OpenAPI Specification 3 (OAS3), 3.1, and 3.2 are valid, not unused, and result in a valid URL. Properly defining and using server variables is crucial for the accurate representation of API endpoints and preventing potential misconfigurations or security issues.
884884

885885
**Recommended**: Yes
886886

@@ -975,7 +975,7 @@ paths:
975975

976976
### oas3_1-servers-in-webhook
977977

978-
Servers should not be defined in a webhook.
978+
Servers should not be defined in a webhook. Applies to OpenAPI v3.1 and v3.2.
979979

980980
**Recommended:** Yes
981981

@@ -1004,7 +1004,7 @@ webhooks:
10041004

10051005
### oas3_1-callbacks-in-webhook
10061006

1007-
Callbacks should not be defined in a webhook.
1007+
Callbacks should not be defined in a webhook. Applies to OpenAPI v3.1 and v3.2.
10081008

10091009
**Recommended:** Yes
10101010

@@ -1016,3 +1016,39 @@ webhooks:
10161016
post:
10171017
callbacks: ...
10181018
```
1019+
1020+
## OpenAPI v3.2-only
1021+
1022+
These rules will only be applied to OpenAPI v3.2 documents.
1023+
1024+
### oas3_2-no-deprecated-xml-attribute
1025+
1026+
The `xml.attribute` field is deprecated in OpenAPI v3.2. Use `xml.nodeType: attribute` instead.
1027+
1028+
**Recommended:** Yes
1029+
1030+
**Bad Example**
1031+
1032+
```yaml
1033+
components:
1034+
schemas:
1035+
Pet:
1036+
properties:
1037+
name:
1038+
type: string
1039+
xml:
1040+
attribute: true
1041+
```
1042+
1043+
**Good Example**
1044+
1045+
```yaml
1046+
components:
1047+
schemas:
1048+
Pet:
1049+
properties:
1050+
name:
1051+
type: string
1052+
xml:
1053+
nodeType: attribute
1054+
```

0 commit comments

Comments
 (0)