rapidoc 9.1.3 → 9.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -1
- package/dist/index.html.gz +0 -0
- package/dist/rapidoc-min.js +2 -2
- package/dist/rapidoc-min.js.LICENSE.txt +17 -1
- package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
- package/dist/rapidoc-min.js.gz +0 -0
- package/dist/report.html +6 -5
- package/docker/Dockerfile +5 -5
- package/docs/api.html +12 -5
- package/docs/examples/dynamic-query-params.html +1 -0
- package/docs/examples/readwrite.html +40 -0
- package/docs/examples.html +3 -2
- package/docs/index.html +2 -2
- package/docs/list.html +6 -2
- package/docs/quickstart.html +1 -1
- package/docs/rapidoc-min.js +2 -2
- package/docs/specs/code-highlight.yaml +1 -1
- package/docs/specs/data-types.yaml +0 -1
- package/docs/specs/examples.yaml +11 -0
- package/docs/specs/petstore_extended.yaml +1 -1
- package/docs/specs/readwrite.yaml +90 -0
- package/docs/specs/temp.json +24 -105
- package/docs/specs/temp.yaml +20 -282
- package/docs/welcome.html +3 -3
- package/index.html +8 -5
- package/package.json +22 -21
- package/src/components/api-request.js +78 -41
- package/src/components/api-response.js +10 -10
- package/src/components/schema-table.js +51 -14
- package/src/components/schema-tree.js +59 -18
- package/src/components/tag-input.js +8 -1
- package/src/json-schema-viewer.js +1 -1
- package/src/rapidoc-mini.js +5 -1
- package/src/rapidoc.js +5 -1
- package/src/styles/font-styles.js +3 -2
- package/src/styles/nav-styles.js +2 -2
- package/src/templates/components-template.js +5 -5
- package/src/templates/endpoint-template.js +1 -1
- package/src/templates/expanded-endpoint-template.js +1 -1
- package/src/templates/focused-endpoint-template.js +1 -1
- package/src/templates/header-template.js +1 -1
- package/src/templates/json-schema-viewer-template.js +8 -8
- package/src/templates/main-body-template.js +4 -1
- package/src/templates/navbar-template.js +2 -2
- package/src/templates/overview-template.js +5 -2
- package/src/templates/security-scheme-template.js +48 -13
- package/src/templates/server-template.js +1 -1
- package/src/utils/common-utils.js +2 -1
- package/src/utils/schema-utils.js +14 -9
- package/src/utils/spec-parser.js +3 -3
- package/webpack.config.js +1 -0
- package/docs/specs/tenants.json +0 -12
|
@@ -389,10 +389,12 @@ export function schemaToSampleObj(schema, config = { }) {
|
|
|
389
389
|
const oneOfSamples = schemaToSampleObj(schema.oneOf[key], config);
|
|
390
390
|
for (const sampleKey in oneOfSamples) {
|
|
391
391
|
// 2. In the final example include a one-of item along with properties
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
392
|
+
if (oneOfSamples[sampleKey] === null) {
|
|
393
|
+
const finalExample = Object.assign(oneOfSamples[sampleKey], objWithSchemaProps);
|
|
394
|
+
obj[`example-${i}`] = finalExample;
|
|
395
|
+
addSchemaInfoToExample(schema.oneOf[key], obj[`example-${i}`]);
|
|
396
|
+
i++;
|
|
397
|
+
}
|
|
396
398
|
}
|
|
397
399
|
}
|
|
398
400
|
}
|
|
@@ -436,10 +438,10 @@ export function schemaToSampleObj(schema, config = { }) {
|
|
|
436
438
|
obj['example-0'] = schema.example;
|
|
437
439
|
} else {
|
|
438
440
|
for (const propertyName in schema.properties) {
|
|
439
|
-
if (schema.properties[propertyName]
|
|
440
|
-
if (schema.properties[propertyName]
|
|
441
|
-
if (schema.properties[propertyName]
|
|
442
|
-
if (schema.properties[propertyName]
|
|
441
|
+
if (schema.properties[propertyName]?.deprecated && !config.includeDeprecated) { continue; }
|
|
442
|
+
if (schema.properties[propertyName]?.readOnly && !config.includeReadOnly) { continue; }
|
|
443
|
+
if (schema.properties[propertyName]?.writeOnly && !config.includeWriteOnly) { continue; }
|
|
444
|
+
if (schema.properties[propertyName]?.type === 'array' || schema.properties[propertyName]?.items) {
|
|
443
445
|
if (schema.properties[propertyName].example) {
|
|
444
446
|
addPropertyExampleToObjectExamples(schema.properties[propertyName].example, obj, propertyName);
|
|
445
447
|
} else if (schema.properties[propertyName]?.items?.example) { // schemas and properties support single example but not multiple examples.
|
|
@@ -622,6 +624,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
622
624
|
obj['::description'] = schema.description || '';
|
|
623
625
|
obj['::type'] = 'object';
|
|
624
626
|
obj['::deprecated'] = schema.deprecated || false;
|
|
627
|
+
obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
|
625
628
|
for (const key in schema.properties) {
|
|
626
629
|
if (schema.required && schema.required.includes(key)) {
|
|
627
630
|
obj[`${key}*`] = schemaInObjectNotation(schema.properties[key], {}, (level + 1));
|
|
@@ -639,6 +642,8 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
639
642
|
? `array<${schema.items.description}>`
|
|
640
643
|
: '';
|
|
641
644
|
obj['::type'] = 'array';
|
|
645
|
+
obj['::deprecated'] = schema.deprecated || false;
|
|
646
|
+
obj['::readwrite'] = schema.readOnly ? 'readonly' : schema.writeOnly ? 'writeonly' : '';
|
|
642
647
|
if (schema.items.items) {
|
|
643
648
|
obj['::array-type'] = schema.items.items.type;
|
|
644
649
|
}
|
|
@@ -654,7 +659,7 @@ export function schemaInObjectNotation(schema, obj, level = 0, suffix = '') {
|
|
|
654
659
|
}
|
|
655
660
|
|
|
656
661
|
/* Create Example object */
|
|
657
|
-
export function generateExample(examples = '', example = '',
|
|
662
|
+
export function generateExample(schema, mimeType, examples = '', example = '', includeReadOnly = true, includeWriteOnly = true, outputType = 'json', includeGeneratedExample = false) {
|
|
658
663
|
const finalExamples = [];
|
|
659
664
|
// First check if examples is provided
|
|
660
665
|
if (examples) {
|
package/src/utils/spec-parser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-use-before-define */
|
|
2
2
|
import OpenApiParser from '@apitools/openapi-parser';
|
|
3
|
-
import marked from 'marked';
|
|
3
|
+
import { marked } from 'marked';
|
|
4
4
|
import { invalidCharsRegEx, rapidocApiKey, sleep } from '~/utils/common-utils';
|
|
5
5
|
|
|
6
6
|
export default async function ProcessSpec(specUrl, generateMissingTags = false, sortTags = false, sortEndpointsBy = '', attrApiKey = '', attrApiKeyLocation = '', attrApiKeyValue = '', serverUrl = '') {
|
|
@@ -50,7 +50,7 @@ export default async function ProcessSpec(specUrl, generateMissingTags = false,
|
|
|
50
50
|
// const pathGroups = groupByPaths(jsonParsedSpec);
|
|
51
51
|
|
|
52
52
|
// Tags with Paths and WebHooks
|
|
53
|
-
const tags = groupByTags(jsonParsedSpec, generateMissingTags, sortTags
|
|
53
|
+
const tags = groupByTags(jsonParsedSpec, sortEndpointsBy, generateMissingTags, sortTags);
|
|
54
54
|
|
|
55
55
|
// Components
|
|
56
56
|
const components = getComponents(jsonParsedSpec);
|
|
@@ -239,7 +239,7 @@ function getComponents(openApiSpec) {
|
|
|
239
239
|
return components || [];
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
function groupByTags(openApiSpec, generateMissingTags = false, sortTags = false
|
|
242
|
+
function groupByTags(openApiSpec, sortEndpointsBy, generateMissingTags = false, sortTags = false) {
|
|
243
243
|
const supportedMethods = ['get', 'put', 'post', 'delete', 'patch', 'head', 'options']; // this is also used for ordering endpoints by methods
|
|
244
244
|
const tags = openApiSpec.tags && Array.isArray(openApiSpec.tags)
|
|
245
245
|
? openApiSpec.tags.map((v) => ({
|
package/webpack.config.js
CHANGED
package/docs/specs/tenants.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Tenant Details",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"empId" : { "type": "string", "description": "Employee ID" },
|
|
6
|
-
"firstName" : { "type": "string", "description": "First name" },
|
|
7
|
-
"lastName" : { "type": "string", "description": "Last Name" },
|
|
8
|
-
"jobTitle" : { "type": "string", "description": "Job title" },
|
|
9
|
-
"department": { "type": "string", "description": "Department name"},
|
|
10
|
-
"salary" : { "type": "number", "description": "Salary per annum"}
|
|
11
|
-
}
|
|
12
|
-
}
|