@redocly/openapi-docs 3.0.0-alpha.79 → 3.0.0-alpha.80
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/console.redocly-openapi-docs.min.js +1 -1
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-openapi-docs.min.js +638 -637
- package/lib/services/code-samples/generator.js +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/constants.d.ts +1 -0
- package/lib/services/code-samples/httpsnippet/helpers/constants.js +1 -1
- package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.d.ts +2 -0
- package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +1 -1
- package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +1 -1
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.d.ts +10 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +2 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.d.ts +10 -0
- package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +2 -0
- package/lib/services/code-samples/httpsnippet/targets/index.d.ts +9 -0
- package/lib/services/code-samples/httpsnippet/targets/index.js +1 -1
- package/lib/services/code-samples/types.d.ts +5 -2
- package/lib/utils/helpers.d.ts +2 -0
- package/lib/utils/helpers.js +1 -1
- package/lib/utils/typeGuards.d.ts +1 -0
- package/lib/utils/typeGuards.js +1 -1
- package/lib-esm/services/code-samples/generator.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/code-builder.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/constants.d.ts +1 -0
- package/lib-esm/services/code-samples/httpsnippet/helpers/constants.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.d.ts +2 -0
- package/lib-esm/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/csharp/httpclient.js +1 -1
- package/lib-esm/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.d.ts +10 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +2 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.d.ts +10 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +2 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/index.d.ts +9 -0
- package/lib-esm/services/code-samples/httpsnippet/targets/index.js +1 -1
- package/lib-esm/services/code-samples/types.d.ts +5 -2
- package/lib-esm/utils/helpers.d.ts +2 -0
- package/lib-esm/utils/helpers.js +1 -1
- package/lib-esm/utils/typeGuards.d.ts +1 -0
- package/lib-esm/utils/typeGuards.js +1 -1
- package/package.json +1 -1
|
@@ -66,6 +66,15 @@ declare const targets: {
|
|
|
66
66
|
};
|
|
67
67
|
httpclient: import("..").LanguageHandler<import("../..").BasicLanguageOptions | undefined>;
|
|
68
68
|
};
|
|
69
|
+
csharpNewtonsoft: {
|
|
70
|
+
info: {
|
|
71
|
+
key: string;
|
|
72
|
+
title: string;
|
|
73
|
+
extname: string;
|
|
74
|
+
default: string;
|
|
75
|
+
};
|
|
76
|
+
httpclient: import("..").LanguageHandler<import("../..").BasicLanguageOptions | undefined>;
|
|
77
|
+
};
|
|
69
78
|
go: {
|
|
70
79
|
info: {
|
|
71
80
|
key: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import javascript from"./javascript";import node from"./node";import python from"./python";import shell from"./shell";import java8 from"./java8";import java from"./java";import csharp from"./csharp";import go from"./go";import php from"./php";import ruby from"./ruby";import r from"./r";const targets={javascript:javascript,node:node,python:python,shell:shell,java8:java8,java:java,csharp:csharp,go:go,php:php,ruby:ruby,r:r};export default targets;
|
|
1
|
+
import javascript from"./javascript";import node from"./node";import python from"./python";import shell from"./shell";import java8 from"./java8";import java from"./java";import csharp from"./csharp";import csharpNewtonsoft from"./csharpNewtonsoft";import go from"./go";import php from"./php";import ruby from"./ruby";import r from"./r";const targets={javascript:javascript,node:node,python:python,shell:shell,java8:java8,java:java,csharp:csharp,csharpNewtonsoft:csharpNewtonsoft,go:go,php:php,ruby:ruby,r:r};export default targets;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Languages = 'JavaScript' | 'Node.js' | 'curl' | 'Java8+Apache' | 'Java' | 'Python' | 'Go' | 'PHP' | 'C#' | 'Ruby' | 'R';
|
|
1
|
+
export type Languages = 'JavaScript' | 'Node.js' | 'curl' | 'Java8+Apache' | 'Java' | 'Python' | 'Go' | 'PHP' | 'C#' | 'C#+Newtonsoft' | 'Ruby' | 'R';
|
|
2
2
|
export interface BasicLanguageOptions {
|
|
3
3
|
indent?: string;
|
|
4
4
|
withImports?: boolean;
|
|
@@ -39,6 +39,9 @@ export interface JavaCodeSampleConfig extends CodeSampleBasicConfig {
|
|
|
39
39
|
export interface CSharpCodeSampleConfig extends CodeSampleBasicConfig {
|
|
40
40
|
lang: 'C#';
|
|
41
41
|
}
|
|
42
|
+
export interface CSharpNewtonsoftCodeSampleConfig extends CodeSampleBasicConfig {
|
|
43
|
+
lang: 'C#+Newtonsoft';
|
|
44
|
+
}
|
|
42
45
|
export interface PHPCodeSampleConfig extends CodeSampleBasicConfig {
|
|
43
46
|
lang: 'PHP';
|
|
44
47
|
}
|
|
@@ -48,7 +51,7 @@ export interface RubyCodeSampleConfig extends CodeSampleBasicConfig {
|
|
|
48
51
|
export interface RCodeSampleConfig extends CodeSampleBasicConfig {
|
|
49
52
|
lang: 'R';
|
|
50
53
|
}
|
|
51
|
-
export type CodeSampleConfig = CurlCodeSampleConfig | JavaScriptCodeSampleConfig | NodeJsCodeSampleConfig | PythonCodeSampleConfig | Java8CodeSampleConfig | JavaCodeSampleConfig | CSharpCodeSampleConfig | PHPCodeSampleConfig | GoCodeSampleConfig | RubyCodeSampleConfig | RCodeSampleConfig;
|
|
54
|
+
export type CodeSampleConfig = CurlCodeSampleConfig | JavaScriptCodeSampleConfig | NodeJsCodeSampleConfig | PythonCodeSampleConfig | Java8CodeSampleConfig | JavaCodeSampleConfig | CSharpCodeSampleConfig | CSharpNewtonsoftCodeSampleConfig | PHPCodeSampleConfig | GoCodeSampleConfig | RubyCodeSampleConfig | RCodeSampleConfig;
|
|
52
55
|
/**
|
|
53
56
|
* Code Samples Generator rules
|
|
54
57
|
* - Reference docs always displays all user custom x-code-samples
|
|
@@ -45,3 +45,5 @@ export declare function getWindowReferenceOptions<T>(option: string): T | null;
|
|
|
45
45
|
export declare function getJsUrl(): string;
|
|
46
46
|
export declare const normalizeText: (text?: string | GenericObject) => string;
|
|
47
47
|
export declare const getValueFromMdParsedExtension: (item: GenericObject, key: 'description' | 'summary' | 'x-summary' | 'x-enumDescriptions') => any;
|
|
48
|
+
export declare function isLastInArray(arr: Array<unknown>, index: number): boolean;
|
|
49
|
+
export declare function isLastProperty(obj: Object, key: string): boolean;
|
package/lib-esm/utils/helpers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{format,parse}from"url";import{ZERO_BREAKPOINT}from"./media-css";import{isNamedDefinition}from"./openapi";import{JsonPointer}from"./JsonPointer";import{IS_BROWSER}from"./dom";import{isString}from"./typeGuards";export function mapWithLast(e,t){const r=[];for(let n=0;n<e.length-1;n++)r.push(t(e[n],!1));return 0!==e.length&&r.push(t(e[e.length-1],!0)),r}export function mapValues(e,t){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n,e));return r}export function flattenByProp(e,t){const r=[],n=e=>{for(const o of e)r.push(o),o[t]&&n(o[t])};return n(e),r}export function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}export function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}export function appendToMdHeading(e,t,r){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(e))return e.replace(o,`$1\n\n${r}\n$4`);{const n=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return`${e}${n}# ${t}\n\n${r}`}}export const mergeObjects=(e,...t)=>{if(!t.length)return e;const r=t.shift();return void 0===r?e:(isMergeableObject(e)&&isMergeableObject(r)&&Object.keys(r).forEach((t=>{isMergeableObject(r[t])?(e[t]||(e[t]={}),["string","number"].includes(typeof e[t])&&(r[t][ZERO_BREAKPOINT]||0===r[t][ZERO_BREAKPOINT]||console.warn(`Theme resolver: using default value of "${e[t]}" for "${t}". This is not recommended. Prefer adding default value by providing "${ZERO_BREAKPOINT}" property to ${JSON.stringify(r[t])}.`),e[t]={[ZERO_BREAKPOINT]:e[t]}),mergeObjects(e[t],r[t])):e[t]=r[t]})),mergeObjects(e,...t))};export const isObject=e=>null!==e&&"object"==typeof e;export const isArrayOfObjects=e=>Array.isArray(e)&&e.some((e=>isObject(e)));export const deleteEmptyArrayItem=e=>e.filter((e=>!!e));export const isMergeableObject=e=>isObject(e)&&!Array.isArray(e);export function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}export function resolveUrl(e,t){let r;if(t.startsWith("//")){const{protocol:n}=parse(e);r=`${n||"https:"}${t}`}else if(isAbsoluteUrl(t))r=t;else if(t.startsWith("/")){const n=parse(e);r=format(Object.assign(Object.assign({},n),{pathname:t}))}else r=stripTrailingSlash(e)+"/"+t;return stripTrailingSlash(r)}export function getBasePath(e){try{return parseURL(e).pathname}catch(t){return e}}export function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}export function removeQueryStringAndHash(e){try{const t=parseURL(e);return t.search="",t.hash="",t.toString()}catch(t){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}export function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,10)))).replace(/&/g,"&").replace(/"/g,'"')}export function sanitizeItemId(e){return e&&e.replace(/#/g,"_")}export function useSchemaTitle(e,t){return t||isNamedDefinition(e)&&JsonPointer.baseName(e)||""}export function get(e={},t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce(((e,t)=>e&&e[t]?e[t]:r),e)}export function joinStringFactory(e){return(...t)=>t.filter(Boolean).join(e)}export const dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";const t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${t}"><\/script>`),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}export const normalizeText=e=>isString(e)?e:null==e?void 0:e.raw;export const getValueFromMdParsedExtension=(e,t)=>{const r=e[`x-parsed-md-${t}`]||e[t];if("x-enumDescriptions"!==t)return r;let n={};for(const e in r)e.startsWith("x-parsed-md")||(n[e]=r[`x-parsed-md-${e}`]||r[e]);return Object.keys(n).length?n:r};
|
|
1
|
+
import{format,parse}from"url";import{ZERO_BREAKPOINT}from"./media-css";import{isNamedDefinition}from"./openapi";import{JsonPointer}from"./JsonPointer";import{IS_BROWSER}from"./dom";import{isString}from"./typeGuards";export function mapWithLast(e,t){const r=[];for(let n=0;n<e.length-1;n++)r.push(t(e[n],!1));return 0!==e.length&&r.push(t(e[e.length-1],!0)),r}export function mapValues(e,t){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n,e));return r}export function flattenByProp(e,t){const r=[],n=e=>{for(const o of e)r.push(o),o[t]&&n(o[t])};return n(e),r}export function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}export function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}export function appendToMdHeading(e,t,r){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(e))return e.replace(o,`$1\n\n${r}\n$4`);{const n=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return`${e}${n}# ${t}\n\n${r}`}}export const mergeObjects=(e,...t)=>{if(!t.length)return e;const r=t.shift();return void 0===r?e:(isMergeableObject(e)&&isMergeableObject(r)&&Object.keys(r).forEach((t=>{isMergeableObject(r[t])?(e[t]||(e[t]={}),["string","number"].includes(typeof e[t])&&(r[t][ZERO_BREAKPOINT]||0===r[t][ZERO_BREAKPOINT]||console.warn(`Theme resolver: using default value of "${e[t]}" for "${t}". This is not recommended. Prefer adding default value by providing "${ZERO_BREAKPOINT}" property to ${JSON.stringify(r[t])}.`),e[t]={[ZERO_BREAKPOINT]:e[t]}),mergeObjects(e[t],r[t])):e[t]=r[t]})),mergeObjects(e,...t))};export const isObject=e=>null!==e&&"object"==typeof e;export const isArrayOfObjects=e=>Array.isArray(e)&&e.some((e=>isObject(e)));export const deleteEmptyArrayItem=e=>e.filter((e=>!!e));export const isMergeableObject=e=>isObject(e)&&!Array.isArray(e);export function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}export function resolveUrl(e,t){let r;if(t.startsWith("//")){const{protocol:n}=parse(e);r=`${n||"https:"}${t}`}else if(isAbsoluteUrl(t))r=t;else if(t.startsWith("/")){const n=parse(e);r=format(Object.assign(Object.assign({},n),{pathname:t}))}else r=stripTrailingSlash(e)+"/"+t;return stripTrailingSlash(r)}export function getBasePath(e){try{return parseURL(e).pathname}catch(t){return e}}export function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}export function removeQueryStringAndHash(e){try{const t=parseURL(e);return t.search="",t.hash="",t.toString()}catch(t){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}export function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,10)))).replace(/&/g,"&").replace(/"/g,'"')}export function sanitizeItemId(e){return e&&e.replace(/#/g,"_")}export function useSchemaTitle(e,t){return t||isNamedDefinition(e)&&JsonPointer.baseName(e)||""}export function get(e={},t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce(((e,t)=>e&&e[t]?e[t]:r),e)}export function joinStringFactory(e){return(...t)=>t.filter(Boolean).join(e)}export const dottedString=joinStringFactory(".");export function getWindowReferenceOptions(e){var t;return IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}export function getJsUrl(){var e;if(!IS_BROWSER)return"";const t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${t}"><\/script>`),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}export const normalizeText=e=>isString(e)?e:null==e?void 0:e.raw;export const getValueFromMdParsedExtension=(e,t)=>{const r=e[`x-parsed-md-${t}`]||e[t];if("x-enumDescriptions"!==t)return r;let n={};for(const e in r)e.startsWith("x-parsed-md")||(n[e]=r[`x-parsed-md-${e}`]||r[e]);return Object.keys(n).length?n:r};export function isLastInArray(e,t){return t===e.length-1}export function isLastProperty(e,t){const r=Object.keys(e);return r.indexOf(t)===r.length-1}
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -2,3 +2,4 @@ export declare function isUndefined<T>(value: T | undefined): value is undefined
|
|
|
2
2
|
export declare function isNull<T>(value: T | null): value is null;
|
|
3
3
|
export declare function isString<T>(value: T | string): value is string;
|
|
4
4
|
export declare function isNotNull<T>(value: T): value is NonNullable<T>;
|
|
5
|
+
export declare function checkIfIsObject(item: unknown): item is Object;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function isUndefined(
|
|
1
|
+
export function isUndefined(t){return void 0===t}export function isNull(t){return null===t}export function isString(t){return"string"==typeof t}export function isNotNull(t){return!isNull(t)}export function checkIfIsObject(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}
|
|
2
2
|
//# sourceMappingURL=typeGuards.js.map
|