Skip to content

Commit 389b83f

Browse files
committed
added device authorization flow; added tests
1 parent 128b038 commit 389b83f

File tree

16 files changed

+812
-9
lines changed

16 files changed

+812
-9
lines changed

.changeset/spotty-bushes-win.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@redocly/openapi-core": minor
3+
"@redocly/cli": minor
4+
---
5+
6+
Added basic support for **OpenAPI 3.2** specification.

CONTRIBUTING.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ Before submitting your contribution though, please make sure to take a moment an
1818

1919
## Issue reporting guidelines
2020

21-
- Before opening a new issue, try to make sure the same problem or idea hasn't already been reported. You can do that on the [Issues page](https://github.com/Redocly/redocly-cli/issues) in the repository and using the filter `is:issue` combined with some keywords relevant to your idea or problem. It helps us notice that more people have the same issue or use-case, and reduces the chance of getting your issue marked as a duplicate. Plus, you can even find some workarounds for your issue in the comments of a previously reported one!
21+
- Before opening a new issue, try to make sure the same problem or idea hasn't already been reported.
22+
You can do that on the [Issues page](https://github.com/Redocly/redocly-cli/issues) in the repository and using the filter `is:issue` combined with some keywords relevant to your idea or problem.
23+
It helps us notice that more people have the same issue or use-case, and reduces the chance of getting your issue marked as a duplicate.
24+
Plus, you can even find some workarounds for your issue in the comments of a previously reported one!
2225

23-
- The best way to get your bug fixed is to provide a (reduced) test case. This means listing and explaining the steps we should take to try and hit the same problem you're having. It helps us understand in which conditions the issue appears, and gives us a better idea of what may be causing it.
26+
- The best way to get your bug fixed is to provide a (reduced) test case.
27+
This means listing and explaining the steps we should take to try and hit the same problem you're having.
28+
It helps us understand in which conditions the issue appears, and gives us a better idea of what may be causing it.
2429

2530
- Abide by our [Code of Conduct](https://redocly.com/code-of-conduct/) in all your interactions on this repository, and show patience and respect to other community members.
2631

@@ -33,8 +38,15 @@ Before submitting a pull request, please make sure the following is done:
3338
1. If you've fixed a bug or added code that should be tested, don't forget to add [tests](#tests)!
3439
1. Ensure the test suite passes (see the [Tests section](#tests) for more details).
3540
1. Format your code with prettier (`npm run prettier`).
36-
1. Each feat/fix PR should also contain a changeset (to create one, run `npx changeset`; if your changes are scoped to `packages/core` or `packages/respect-core` but also affect Redocly CLI behavior, please include the `@redocly/cli` package as well). Please describe what you've done in this PR using sentence case (you can refer to our [changelog](https://redocly.com/docs/cli/changelog/)). This produces a file in `.changeset` folder. Please commit this file along with your changes. If the PR doesn't need a changeset (for example, it is a small change, or updates only documentation), add the 'no changeset needed' label to the PR.
37-
1. When merging a PR, make sure to remove all redundant commit information (like intermediate commit descriptions). Please leave only the main commit description (plus co-authors if needed). If you think it makes sense to keep several commit descriptions, please rebase your PR instead of squashing it to preserve the commits. Please use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
41+
1. Each feat/fix PR should also contain a changeset (to create one, run `npx changeset`;
42+
if your changes are scoped to `packages/core` or `packages/respect-core` but also affect Redocly CLI behavior, please include the `@redocly/cli` package as well).
43+
Please describe what you've done in this PR using sentence case (you can refer to our [changelog](https://redocly.com/docs/cli/changelog/)).
44+
This produces a file in `.changeset` folder.
45+
Please commit this file along with your changes. If the PR doesn't need a changeset (for example, it is a small change, or updates only documentation), add the 'no changeset needed' label to the PR.
46+
1. When merging a PR, make sure to remove all redundant commit information (like intermediate commit descriptions).
47+
Please leave only the main commit description (plus co-authors if needed).
48+
If you think it makes sense to keep several commit descriptions, please rebase your PR instead of squashing it to preserve the commits.
49+
Please use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format.
3850

3951
## Development setup
4052

@@ -87,7 +99,8 @@ When contributing to Redocly CLI, it's important to follow these logging guideli
8799
logger.output(JSON.stringify(stats, null, 2));
88100
```
89101

90-
4. Avoid using `console.log`, `console.error`, or direct `process.stdout.write`/`process.stderr.write` calls. Always use the logger methods to ensure consistent output formatting and proper stream usage.
102+
4. Avoid using `console.log`, `console.error`, or direct `process.stdout.write`/`process.stderr.write` calls.
103+
Always use the logger methods to ensure consistent output formatting and proper stream usage.
91104

92105
## Local source code usage
93106

@@ -106,7 +119,8 @@ To test local changes as a package, you can use the following steps:
106119
1. Run `npm run pack:prepare` in the repository's root.
107120
This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.
108121

109-
1. Copy those **.tgz** files to a destination folder and then run `npm install redocly-cli.tgz` there to install Redocly CLI. To install `openapi-core` do the same but with **openapi-core.tgz** file.
122+
1. Copy those **.tgz** files to a destination folder and then run `npm install redocly-cli.tgz` there to install Redocly CLI.
123+
To install `openapi-core` do the same but with **openapi-core.tgz** file.
110124

111125
## Contribute documentation
112126

@@ -239,7 +253,8 @@ const err = result.stderr ? result.stderr.toString() : '';
239253
return `${out}\n${err}`;
240254
```
241255

242-
This is intentional behavior to have consistent command outputs where NodeJS handles the output buffering. When writing tests, keep in mind that the order of stdout and stderr messages in the actual output might differ from what you see in the terminal, but the combined output will be consistent for snapshot testing.
256+
This is intentional behavior to have consistent command outputs where NodeJS handles the output buffering.
257+
When writing tests, keep in mind that the order of stdout and stderr messages in the actual output might differ from what you see in the terminal, but the combined output will be consistent for snapshot testing.
243258

244259
### Smoke tests
245260

__tests__/check-config/wrong-config-type-extensions-in-assertions/snapshot.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[1] redocly.yaml:10:13 at #/rules/rule~1metadata-lifecycle/subject/type
22

3-
`type` can be one of the following only: "any", "Root", "Tag", "TagList", "TagGroups", "TagGroup", "ExternalDocs", "Example", "ExamplesMap", "EnumDescriptions", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Logo", "Paths", "PathItem", "Parameter", "ParameterItems", "ParameterList", "Operation", "Examples", "Header", "Responses", "Response", "Schema", "Xml", "SchemaProperties", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedSecuritySchemes", "SecurityScheme", "XCodeSample", "XCodeSampleList", "XServerList", "XServer", "Server", "ServerList", "ServerVariable", "ServerVariablesMap", "Callback", "CallbacksMap", "RequestBody", "MediaTypesMap", "MediaType", "Encoding", "EncodingMap", "HeadersMap", "Link", "DiscriminatorMapping", "Discriminator", "Components", "LinksMap", "NamedExamples", "NamedRequestBodies", "NamedHeaders", "NamedLinks", "NamedCallbacks", "ImplicitFlow", "PasswordFlow", "ClientCredentials", "AuthorizationCode", "OAuth2Flows", "XUsePkce", "WebhooksMap", "XMetaData", "PatternProperties", "NamedPathItems", "DependentRequired", "HttpServerBinding", "HttpChannelBinding", "HttpMessageBinding", "HttpOperationBinding", "WsServerBinding", "WsChannelBinding", "WsMessageBinding", "WsOperationBinding", "KafkaServerBinding", "KafkaTopicConfiguration", "KafkaChannelBinding", "KafkaMessageBinding", "KafkaOperationBinding", "AnypointmqServerBinding", "AnypointmqChannelBinding", "AnypointmqMessageBinding", "AnypointmqOperationBinding", "AmqpServerBinding", "AmqpChannelBinding", "AmqpMessageBinding", "AmqpOperationBinding", "Amqp1ServerBinding", "Amqp1ChannelBinding", "Amqp1MessageBinding", "Amqp1OperationBinding", "MqttServerBindingLastWill", "MqttServerBinding", "MqttChannelBinding", "MqttMessageBinding", "MqttOperationBinding", "Mqtt5ServerBinding", "Mqtt5ChannelBinding", "Mqtt5MessageBinding", "Mqtt5OperationBinding", "NatsServerBinding", "NatsChannelBinding", "NatsMessageBinding", "NatsOperationBinding", "JmsServerBinding", "JmsChannelBinding", "JmsMessageBinding", "JmsOperationBinding", "SolaceServerBinding", "SolaceChannelBinding", "SolaceMessageBinding", "SolaceDestination", "SolaceOperationBinding", "StompServerBinding", "StompChannelBinding", "StompMessageBinding", "StompOperationBinding", "RedisServerBinding", "RedisChannelBinding", "RedisMessageBinding", "RedisOperationBinding", "MercureServerBinding", "MercureChannelBinding", "MercureMessageBinding", "MercureOperationBinding", "ServerBindings", "ChannelBindings", "MessageBindings", "OperationBindings", "ServerMap", "ChannelMap", "Channel", "ParametersMap", "MessageExample", "NamedMessages", "NamedMessageTraits", "NamedOperationTraits", "NamedCorrelationIds", "SecuritySchemeFlows", "Message", "OperationTrait", "OperationTraitList", "MessageTrait", "MessageTraitList", "MessageExampleList", "CorrelationId", "Dependencies", "OperationReply", "OperationReplyAddress", "NamedTags", "NamedExternalDocs", "NamedChannels", "NamedOperations", "NamedOperationReplies", "NamedOperationRelyAddresses", "SecuritySchemeList", "MessageList", "SourceDescriptions", "OpenAPISourceDescription", "ArazzoSourceDescription", "Parameters", "ReusableObject", "Workflows", "Workflow", "Steps", "Step", "Replacement", "ExtendedOperation", "ExtendedSecurityList", "ExtendedSecurity", "Outputs", "CriterionObject", "XPathCriterion", "JSONPathCriterion", "SuccessActionObject", "OnSuccessActionList", "FailureActionObject", "OnFailureActionList", "NamedInputs", "NamedSuccessActions", "NamedFailureActions", "Actions", "Action", "SpecExtension".
3+
`type` can be one of the following only: "any", "Root", "Tag", "TagList", "TagGroups", "TagGroup", "ExternalDocs", "Example", "ExamplesMap", "EnumDescriptions", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Logo", "Paths", "PathItem", "Parameter", "ParameterItems", "ParameterList", "Operation", "Examples", "Header", "Responses", "Response", "Schema", "Xml", "SchemaProperties", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedSecuritySchemes", "SecurityScheme", "XCodeSample", "XCodeSampleList", "XServerList", "XServer", "Server", "ServerList", "ServerVariable", "ServerVariablesMap", "Callback", "CallbacksMap", "RequestBody", "MediaTypesMap", "MediaType", "Encoding", "EncodingMap", "HeadersMap", "Link", "DiscriminatorMapping", "Discriminator", "Components", "LinksMap", "NamedExamples", "NamedRequestBodies", "NamedHeaders", "NamedLinks", "NamedCallbacks", "ImplicitFlow", "PasswordFlow", "ClientCredentials", "AuthorizationCode", "OAuth2Flows", "XUsePkce", "WebhooksMap", "XMetaData", "PatternProperties", "NamedPathItems", "DependentRequired", "DeviceAuthorization", "HttpServerBinding", "HttpChannelBinding", "HttpMessageBinding", "HttpOperationBinding", "WsServerBinding", "WsChannelBinding", "WsMessageBinding", "WsOperationBinding", "KafkaServerBinding", "KafkaTopicConfiguration", "KafkaChannelBinding", "KafkaMessageBinding", "KafkaOperationBinding", "AnypointmqServerBinding", "AnypointmqChannelBinding", "AnypointmqMessageBinding", "AnypointmqOperationBinding", "AmqpServerBinding", "AmqpChannelBinding", "AmqpMessageBinding", "AmqpOperationBinding", "Amqp1ServerBinding", "Amqp1ChannelBinding", "Amqp1MessageBinding", "Amqp1OperationBinding", "MqttServerBindingLastWill", "MqttServerBinding", "MqttChannelBinding", "MqttMessageBinding", "MqttOperationBinding", "Mqtt5ServerBinding", "Mqtt5ChannelBinding", "Mqtt5MessageBinding", "Mqtt5OperationBinding", "NatsServerBinding", "NatsChannelBinding", "NatsMessageBinding", "NatsOperationBinding", "JmsServerBinding", "JmsChannelBinding", "JmsMessageBinding", "JmsOperationBinding", "SolaceServerBinding", "SolaceChannelBinding", "SolaceMessageBinding", "SolaceDestination", "SolaceOperationBinding", "StompServerBinding", "StompChannelBinding", "StompMessageBinding", "StompOperationBinding", "RedisServerBinding", "RedisChannelBinding", "RedisMessageBinding", "RedisOperationBinding", "MercureServerBinding", "MercureChannelBinding", "MercureMessageBinding", "MercureOperationBinding", "ServerBindings", "ChannelBindings", "MessageBindings", "OperationBindings", "ServerMap", "ChannelMap", "Channel", "ParametersMap", "MessageExample", "NamedMessages", "NamedMessageTraits", "NamedOperationTraits", "NamedCorrelationIds", "SecuritySchemeFlows", "Message", "OperationTrait", "OperationTraitList", "MessageTrait", "MessageTraitList", "MessageExampleList", "CorrelationId", "Dependencies", "OperationReply", "OperationReplyAddress", "NamedTags", "NamedExternalDocs", "NamedChannels", "NamedOperations", "NamedOperationReplies", "NamedOperationRelyAddresses", "SecuritySchemeList", "MessageList", "SourceDescriptions", "OpenAPISourceDescription", "ArazzoSourceDescription", "Parameters", "ReusableObject", "Workflows", "Workflow", "Steps", "Step", "Replacement", "ExtendedOperation", "ExtendedSecurityList", "ExtendedSecurity", "Outputs", "CriterionObject", "XPathCriterion", "JSONPathCriterion", "SuccessActionObject", "OnSuccessActionList", "FailureActionObject", "OnFailureActionList", "NamedInputs", "NamedSuccessActions", "NamedFailureActions", "Actions", "Action", "SpecExtension".
44

55
8 | rule/metadata-lifecycle:
66
9 | subject:

__tests__/commands.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ describe('E2E', () => {
398398
'references-in-parameters',
399399
'ignore-decorators',
400400
'multi-references-to-one-file',
401+
'oas3.2',
401402
];
402403

403404
test.each(testDirNames)('test: %s', async (dir) => {

__tests__/join/oas3.2/bar.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
openapi: 3.2.0
2+
info:
3+
title: Test2
4+
version: v2
5+
tags:
6+
- name: successfully
7+
- name: books
8+
summary: Books & Literature
9+
description: Book catalog and recommendations
10+
parent: products
11+
kind: nav
12+
wrong: fail!
13+
paths:
14+
/products:
15+
additionalOperations:
16+
test:
17+
summary: Additional op test
18+
wrong: Should catch wrong fields in additionalOperations!
19+
query:
20+
summary: Advanced product search
21+
wrong: Should catch wrong fields in the QUERY method!
22+
requestBody:
23+
required: true
24+
content:
25+
application/json:
26+
schema:
27+
type: object
28+
properties:
29+
filter:
30+
type: object
31+
sort:
32+
type: array
33+
items:
34+
type: string
35+
components:
36+
securitySchemes:
37+
api_key:
38+
type: apiKey
39+
in: header
40+
name: X-API-Key
41+
deprecated: true

__tests__/join/oas3.2/foo.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
openapi: 3.2.0
2+
info:
3+
title: Test
4+
version: v1
5+
security: []
6+
servers:
7+
- name: Should allow name
8+
url: http://localhost
9+
wrong: Should catch wrong fields in servers!
10+
$self: Should pass
11+
tags:
12+
- name: cds
13+
summary: Music CDs
14+
description: Music CD catalog and reviews
15+
parent: products
16+
kind: nav
17+
18+
- name: giftcards
19+
summary: Gift Cards
20+
description: Digital and physical gift cards
21+
parent: products
22+
kind: nav
23+
24+
- name: digital-delivery
25+
summary: Digital Delivery
26+
description: Instantly delivered digital products
27+
kind: badge
28+
29+
paths:
30+
/products:
31+
get:
32+
tags:
33+
- giftcards
34+
- digital-delivery
35+
summary: List available gift cards
36+
responses:
37+
'200':
38+
description: Search results
39+
/stream:
40+
get:
41+
summary: Stream
42+
responses:
43+
200:
44+
description: Stream of updates
45+
content:
46+
text/event-stream:
47+
itemSchema: # Should allow itemSchema
48+
type: object
49+
properties:
50+
id: { type: string }
51+
data: { type: object }
52+
/thing:
53+
get:
54+
summary: a sample api
55+
responses:
56+
'200':
57+
description: OK
58+
content:
59+
multipart/mixed:
60+
itemSchema: # Should allow itemSchema
61+
$comment: A single data image from the device
62+
itemEncoding: # Should allow itemEncoding
63+
contentType: image/jpg
64+
/querystring:
65+
parameters:
66+
- in: querystring
67+
name: querystring_test
68+
content:
69+
application/x-www-form-urlencoded:
70+
schema:
71+
type: object
72+
properties:
73+
foo:
74+
type: string
75+
bar:
76+
type: boolean
77+
examples:
78+
spacesAndPluses:
79+
description: Note handling of spaces and "+" per media type.
80+
dataValue:
81+
foo: a + b
82+
bar: true
83+
serializedValue: foo=a+%2B+b&bar=true
84+
examples:
85+
spacesAndPluses:
86+
description: |
87+
Note that no additional percent encoding is done, as this
88+
media type is URI query string-ready by definition.
89+
dataValue:
90+
foo: a + b
91+
bar: true
92+
serializedValue: foo=a+%2B+b&bar=true
93+
components:
94+
securitySchemes:
95+
petstore_auth:
96+
type: oauth2
97+
deprecated: true # Should allow deprecation
98+
oauth2MetadataUrl: http://localhost # Should be allowed
99+
flows:
100+
implicit:
101+
authorizationUrl: https://example.org/api/oauth/dialog
102+
wrong: Should catch wrong prop in oauth2 flows!
103+
scopes:
104+
write:pets: modify pets in your account
105+
read:pets: read your pets

0 commit comments

Comments
 (0)