Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@

✅ Your config is valid.
Something went wrong when processing :

- Error parsing config file at 'redocly.yaml': Not implemented

Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
[1] redocly.yaml:10:13 at #/rules/rule~1metadata-lifecycle/subject/type

`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", "Outputs", "CriterionObject", "XPathCriterion", "JSONPathCriterion", "SuccessActionObject", "OnSuccessActionList", "FailureActionObject", "OnFailureActionList", "NamedInputs", "NamedSuccessActions", "NamedFailureActions", "Actions", "Action", "SpecExtension".

8 | rule/metadata-lifecycle:
9 | subject:
10 | type: WrongXMetaData
| ^^^^^^^^^^^^^^
11 | property: 'lifecycle'
12 | assertions:

Error was generated by the configuration struct rule.



Deprecated plugin format detected: type-extension
❌ Your config has 1 error.
Something went wrong when processing :

- Error parsing config file at 'redocly.yaml': Not implemented

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[1] .redocly.yaml:9:17 at #/rules/rule~1path-item-mutually-required/where/0/subject/type

`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", "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", "Outputs", "CriterionObject", "XPathCriterion", "JSONPathCriterion", "SuccessActionObject", "OnSuccessActionList", "FailureActionObject", "OnFailureActionList", "NamedInputs", "NamedSuccessActions", "NamedFailureActions", "Actions", "Action", "SpecExtension".
`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", "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", "Outputs", "CriterionObject", "XPathCriterion", "JSONPathCriterion", "SuccessActionObject", "OnSuccessActionList", "FailureActionObject", "OnFailureActionList", "NamedInputs", "NamedSuccessActions", "NamedFailureActions", "Actions", "Action", "SpecExtension".

7 | where:
8 | - subject:
Expand Down
20 changes: 2 additions & 18 deletions __tests__/lint/arazzo-type-extensions-with-plugin/snapshot.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
[1] museum.yaml:8:3 at #/info/wrong-key

Property `wrong-key` is not expected here.

6 | and information. Built with love by Redocly.
7 | version: 1.0.0
8 | wrong-key: wrong-value
| ^^^^^^^^^
9 | metadata:
10 | lifecycle: production

Error was generated by the struct rule.



Deprecated plugin format detected: type-extension
validating museum.yaml...
museum.yaml: validated in <test>ms
Something went wrong when processing :

❌ Validation failed with 1 error.
run `redocly lint --generate-ignore-file` to add all problems to the ignore file.
- Error parsing config file at 'redocly.yaml': Not implemented

2 changes: 2 additions & 0 deletions packages/cli/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ describe('checkIfRulesetExist', () => {
oas2: {},
oas3_0: {},
oas3_1: {},
oas3_2: {},
async2: {},
async3: {},
arazzo1: {},
Expand All @@ -503,6 +504,7 @@ describe('checkIfRulesetExist', () => {
oas2: { 'operation-4xx-response': 'error' },
oas3_0: {},
oas3_1: {},
oas3_2: {},
} as any;
checkIfRulesetExist(rules);
});
Expand Down
47 changes: 27 additions & 20 deletions packages/cli/src/commands/join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ import type {
BundleResult,
Oas3Definition,
Oas3_1Definition,
Oas3_2Definition,
Oas3Parameter,
Oas3_2Parameter,
Oas3PathItem,
Oas3_2PathItem,
Oas3Server,
Oas3_2Server,
Oas3Tag,
Oas3_2Tag,
} from '@redocly/openapi-core';
import type { CommandArgs } from '../wrapper.js';
import type { VerifyConfigOptions } from '../types.js';
Expand All @@ -47,7 +52,7 @@ type JoinDocumentContext = {
api: string;
apiFilename: string;
apiTitle?: string;
tags: Oas3Tag[];
tags: Oas3Tag[] | Oas3_2Tag[];
potentialConflicts: any;
tagsPrefix: string;
componentsPrefix: string | undefined;
Expand Down Expand Up @@ -109,13 +114,15 @@ export async function handleJoin({
const decorators = new Set([
...Object.keys(config.styleguide.decorators.oas3_0),
...Object.keys(config.styleguide.decorators.oas3_1),
...Object.keys(config.styleguide.decorators.oas3_2),
...Object.keys(config.styleguide.decorators.oas2),
]);
config.styleguide.skipDecorators(Array.from(decorators));

const preprocessors = new Set([
...Object.keys(config.styleguide.preprocessors.oas3_0),
...Object.keys(config.styleguide.preprocessors.oas3_1),
...Object.keys(config.styleguide.preprocessors.oas3_2),
...Object.keys(config.styleguide.preprocessors.oas2),
]);
config.styleguide.skipPreprocessors(Array.from(preprocessors));
Expand Down Expand Up @@ -152,9 +159,9 @@ export async function handleJoin({
try {
const version = detectSpec(document.parsed);
collectSpecData?.(document.parsed);
if (version !== SpecVersion.OAS3_0 && version !== SpecVersion.OAS3_1) {
if (version !== SpecVersion.OAS3_0 && version !== SpecVersion.OAS3_1 && version !== SpecVersion.OAS3_2) {
return exitWithError(
`Only OpenAPI 3.0 and OpenAPI 3.1 are supported: ${blue(document.source.absoluteRef)}.`
`Only OpenAPI 3.0, OpenAPI 3.1, and OpenAPI 3.2 are supported: ${blue(document.source.absoluteRef)}.`
);
}

Expand Down Expand Up @@ -250,7 +257,7 @@ export async function handleJoin({
tag.description = addComponentsPrefix(tag.description, componentsPrefix!);
}

const tagDuplicate = joinedDef.tags.find((t: Oas3Tag) => t.name === entrypointTagName);
const tagDuplicate = joinedDef.tags.find((t: Oas3Tag|Oas3_2Tag) => t.name === entrypointTagName);

if (tagDuplicate && withoutXTagGroups) {
// If tag already exist and `without-x-tag-groups` option,
Expand Down Expand Up @@ -313,13 +320,13 @@ export async function handleJoin({

function populateXTagGroups(entrypointTagName: string, indexGroup: number) {
if (
!joinedDef[xTagGroups][indexGroup][Tags].find((t: Oas3Tag) => t.name === entrypointTagName)
!joinedDef[xTagGroups][indexGroup][Tags].find((t: Oas3Tag|Oas3_2Tag) => t.name === entrypointTagName)
) {
joinedDef[xTagGroups][indexGroup][Tags].push(entrypointTagName);
}
}

function collectServers(openapi: Oas3Definition | Oas3_1Definition) {
function collectServers(openapi: Oas3Definition | Oas3_1Definition | Oas3_2Definition) {
const { servers } = openapi;
if (servers) {
if (!joinedDef.hasOwnProperty('servers')) {
Expand All @@ -334,7 +341,7 @@ export async function handleJoin({
}

function collectExternalDocs(
openapi: Oas3Definition | Oas3_1Definition,
openapi: Oas3Definition | Oas3_1Definition | Oas3_2Definition,
{ api }: JoinDocumentContext
) {
const { externalDocs } = openapi;
Expand All @@ -348,7 +355,7 @@ export async function handleJoin({
}

function collectPaths(
openapi: Oas3Definition | Oas3_1Definition,
openapi: Oas3Definition | Oas3_1Definition | Oas3_2Definition,
{
apiFilename,
apiTitle,
Expand All @@ -373,7 +380,7 @@ export async function handleJoin({
potentialConflicts.paths[path] = {};
}

const pathItem = paths[path] as Oas3PathItem;
const pathItem = paths[path] as Oas3PathItem | Oas3_2PathItem;

for (const field of keysOf(pathItem)) {
if (operationsSet.has(field as OPENAPI3_METHOD)) {
Expand All @@ -393,9 +400,9 @@ export async function handleJoin({
}

function collectPathStringFields(
pathItem: Oas3PathItem,
pathItem: Oas3PathItem | Oas3_2PathItem,
path: string | number,
field: keyof Oas3PathItem
field: keyof Oas3PathItem | Oas3_2PathItem
) {
const fieldValue = pathItem[field];
if (
Expand All @@ -408,7 +415,7 @@ export async function handleJoin({
joinedDef.paths[path][field] = fieldValue;
}

function collectPathServers(pathItem: Oas3PathItem, path: string | number) {
function collectPathServers(pathItem: Oas3PathItem | Oas3_2PathItem, path: string | number) {
if (!pathItem.servers) {
return;
}
Expand All @@ -434,19 +441,19 @@ export async function handleJoin({
}
}

function collectPathParameters(pathItem: Oas3PathItem, path: string | number) {
function collectPathParameters(pathItem: Oas3PathItem | Oas3_2PathItem, path: string | number) {
if (!pathItem.parameters) {
return;
}
if (!joinedDef.paths[path].hasOwnProperty('parameters')) {
joinedDef.paths[path].parameters = [];
}

for (const parameter of pathItem.parameters as Referenced<Oas3Parameter>[]) {
for (const parameter of pathItem.parameters as Referenced<Oas3Parameter | Oas3_2Parameter>[]) {
let isFoundParameter = false;

for (const pathParameter of joinedDef.paths[path]
.parameters as Referenced<Oas3Parameter>[]) {
.parameters as Referenced<Oas3Parameter | Oas3_2Parameter>[]) {
// Compare $ref only if both are reference objects
if (isRef(pathParameter) && isRef(parameter)) {
if (pathParameter['$ref'] === parameter['$ref']) {
Expand All @@ -471,7 +478,7 @@ export async function handleJoin({
}

function collectPathOperation(
pathItem: Oas3PathItem,
pathItem: Oas3PathItem | Oas3_2PathItem,
path: string | number,
operation: OPENAPI3_METHOD
) {
Expand Down Expand Up @@ -540,7 +547,7 @@ export async function handleJoin({
}
}

function isServersEqual(serverOne: Oas3Server, serverTwo: Oas3Server) {
function isServersEqual(serverOne: Oas3Server | Oas3_2Server, serverTwo: Oas3Server | Oas3_2Server) {
if (serverOne.description === serverTwo.description) {
return dequal(serverOne.variables, serverTwo.variables);
}
Expand All @@ -549,7 +556,7 @@ export async function handleJoin({
}

function collectComponents(
openapi: Oas3Definition,
openapi: Oas3Definition | Oas3_1Definition | Oas3_2Definition,
{ api, potentialConflicts, componentsPrefix }: JoinDocumentContext
) {
const { components } = openapi;
Expand All @@ -576,7 +583,7 @@ export async function handleJoin({

function collectWebhooks(
oasVersion: SpecVersion,
openapi: StrictObject<Oas3Definition | Oas3_1Definition>,
openapi: StrictObject<Oas3Definition | Oas3_1Definition | Oas3_2Definition>,
{
apiFilename,
apiTitle,
Expand All @@ -586,7 +593,7 @@ export async function handleJoin({
componentsPrefix,
}: JoinDocumentContext
) {
const webhooks = oasVersion === SpecVersion.OAS3_1 ? 'webhooks' : 'x-webhooks';
const webhooks = (oasVersion === SpecVersion.OAS3_1 || oasVersion === SpecVersion.OAS3_2) ? 'webhooks' : 'x-webhooks';
const openapiWebhooks = openapi[webhooks];
if (openapiWebhooks) {
if (!joinedDef.hasOwnProperty(webhooks)) {
Expand Down
Loading