Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support operations without tags #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22717,13 +22717,15 @@ function collateTags(api) {
});
const generatedTagCache = new Set();
operations.forEach(({ path, operation, operationObject }) => {
if (operationObject.tags.length === 0) {
var _a;
const tags = (_a = operationObject.tags) != null ? _a : [];
if (tags.length === 0) {
tagMap.set(untaggedTag, [
...tagMap.get(untaggedTag) || [],
{ path, operation, operationObject }
]);
}
operationObject.tags.forEach((tagName) => {
tags.forEach((tagName) => {
let tag;
if (api.tags) {
tag = api.tags.find(({ name }) => {
Expand Down
5 changes: 3 additions & 2 deletions lib/spaceGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ export function collateTags(api: OpenAPI.Document) {
const generatedTagCache = new Set<TagObject>();

operations.forEach(({ path, operation, operationObject }) => {
if (operationObject.tags.length === 0) {
const tags = operationObject.tags ?? [];
if (tags.length === 0) {
tagMap.set(untaggedTag, [
...(tagMap.get(untaggedTag) || []),
{ path, operation, operationObject },
]);
}
operationObject.tags.forEach((tagName) => {
tags.forEach((tagName) => {
let tag: TagObject;
if (api.tags) {
tag = api.tags.find(({ name }) => {
Expand Down
5 changes: 3 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ function collateTags(api: OpenAPI.Document) {
}
);
operations.forEach(({ path, operation, operationObject }) => {
if (operationObject.tags.length === 0) {
const tags = operationObject.tags ?? [];
if (tags.length === 0) {
tagMap.set(untaggedTag, [
...(tagMap.get(untaggedTag) || []),
{ path, operation, operationObject },
]);
}
operationObject.tags.forEach((tagName) => {
tags.forEach((tagName) => {
const tag: TagObject = api.tags.find(({ name }) => {
return name === tagName;
});
Expand Down