fix: behaviour for downloadUrls and extend examples to description file

This commit is contained in:
Alex Varchuk 2025-01-30 11:34:09 +01:00
parent 8ed46318c3
commit a680dd716b
No known key found for this signature in database
GPG Key ID: 8A9260AE529FF454
4 changed files with 13 additions and 3 deletions

View File

@ -309,6 +309,9 @@ components:
enum: enum:
- event - event
- general - general
x-enumDescriptions:
event: Special event ticket
general: General museum entry ticket
example: event example: event
Date: Date:
type: string type: string
@ -776,6 +779,9 @@ x-tagGroups:
- name: Purchases - name: Purchases
tags: tags:
- Tickets - Tickets
- name: Entities
tags:
- schemas
security: security:
- MuseumPlaceholderAuth: [] - MuseumPlaceholderAuth: []

View File

@ -11,7 +11,11 @@ const userUrl = window.location.search.match(/url=(.*)$/);
const specUrl = const specUrl =
(userUrl && userUrl[1]) || (swagger ? 'museum.yaml' : big ? 'big-openapi.json' : 'museum.yaml'); (userUrl && userUrl[1]) || (swagger ? 'museum.yaml' : big ? 'big-openapi.json' : 'museum.yaml');
const options: RedocRawOptions = { nativeScrollbars: false, maxDisplayedEnumValues: 3 }; const options: RedocRawOptions = {
nativeScrollbars: false,
maxDisplayedEnumValues: 3,
schemaDefinitionsTagName: 'schemas',
};
const container = document.getElementById('example'); const container = document.getElementById('example');
const root = createRoot(container!); const root = createRoot(container!);

View File

@ -88,7 +88,7 @@ export class ApiInfo extends React.Component<ApiInfoProps> {
rel="noreferrer" rel="noreferrer"
key={url} key={url}
> >
{downloadUrls.length > 1 ? title : l('download')} {title}
</DownloadButton> </DownloadButton>
); );
})} })}

View File

@ -46,7 +46,7 @@ export class ApiInfoModel implements OpenAPIInfo {
}, },
] ]
: this.options.downloadUrls.map(({ title, url }) => ({ : this.options.downloadUrls.map(({ title, url }) => ({
title: title || 'Download OpenAPI description', title: title || l('download'),
url: this.getDownloadLink(url), url: this.getDownloadLink(url),
})) }))
).filter(({ title, url }) => title && url); ).filter(({ title, url }) => title && url);