@stoplight/elements-core 8.4.5 → 8.4.6

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.
@@ -1,6 +1,5 @@
1
1
  import { IMarkdownViewerProps } from '@stoplight/markdown-viewer';
2
- import * as React from 'react';
3
2
  import { DocsComponentProps } from '..';
4
3
  declare type ArticleProps = DocsComponentProps<IMarkdownViewerProps['markdown']>;
5
- export declare const Article: React.FunctionComponent<ArticleProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
4
+ export declare const Article: import("react").FunctionComponent<ArticleProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
6
5
  export {};
@@ -1,8 +1,7 @@
1
1
  import { IHttpEndpointOperation } from '@stoplight/types';
2
- import * as React from 'react';
3
2
  import { DocsComponentProps } from '..';
4
3
  export declare type HttpOperationProps = DocsComponentProps<IHttpEndpointOperation>;
5
- export declare const HttpOperation: React.FunctionComponent<HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
4
+ export declare const HttpOperation: import("react").FunctionComponent<HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
6
5
  export declare function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, hideServerUrl, method, path, }: {
7
6
  id: string;
8
7
  noHeading?: boolean;
@@ -1,5 +1,4 @@
1
1
  import { IHttpService } from '@stoplight/types';
2
- import * as React from 'react';
3
2
  import { DocsComponentProps } from '..';
4
3
  export declare type HttpServiceProps = DocsComponentProps<Partial<IHttpService>>;
5
- export declare const HttpService: React.FunctionComponent<HttpServiceProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
4
+ export declare const HttpService: import("react").FunctionComponent<HttpServiceProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -1,5 +1,4 @@
1
1
  import { JSONSchema7 } from 'json-schema';
2
- import * as React from 'react';
3
2
  import { DocsComponentProps } from '..';
4
3
  export declare type ModelProps = DocsComponentProps<JSONSchema7>;
5
- export declare const Model: React.FunctionComponent<ModelProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
4
+ export declare const Model: import("react").FunctionComponent<ModelProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
package/index.esm.js CHANGED
@@ -114,7 +114,28 @@ const isResolvedObjectProxy = (someObject) => {
114
114
  return !!someObject[originalObjectSymbol];
115
115
  };
116
116
  const getOriginalObject = (resolvedObject) => {
117
- return resolvedObject[originalObjectSymbol] || resolvedObject;
117
+ const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
118
+ if (!originalObject) {
119
+ return resolvedObject;
120
+ }
121
+ const hasAllSchemaErrors = (array) => {
122
+ return array.every(item => item['x-sl-error-message'] !== undefined);
123
+ };
124
+ if (originalObject.anyOf) {
125
+ if (hasAllSchemaErrors(originalObject.anyOf)) {
126
+ return Object.assign(Object.assign({}, originalObject), { anyOf: [originalObject.anyOf] });
127
+ }
128
+ const filteredArray = originalObject.anyOf.filter((item) => !item['x-sl-error-message']);
129
+ return Object.assign(Object.assign({}, originalObject), { anyOf: filteredArray });
130
+ }
131
+ else if (originalObject.oneOf) {
132
+ if (hasAllSchemaErrors(originalObject.oneOf)) {
133
+ return Object.assign(Object.assign({}, originalObject), { oneOf: [originalObject.oneOf] });
134
+ }
135
+ const filteredArray = originalObject.oneOf.filter((item) => !item['x-sl-error-message']);
136
+ return Object.assign(Object.assign({}, originalObject), { oneOf: filteredArray });
137
+ }
138
+ return originalObject;
118
139
  };
119
140
  const isReference = hasRef;
120
141
 
@@ -2993,7 +3014,7 @@ const AdditionalInfo = ({ id, termsOfService, contact, license }) => {
2993
3014
  ? `[${license.name}](${licenseUrl})`
2994
3015
  : (license === null || license === void 0 ? void 0 : license.identifier) && licenseUrl
2995
3016
  ? `[${license === null || license === void 0 ? void 0 : license.identifier}](${licenseUrl})`
2996
- : undefined;
3017
+ : '';
2997
3018
  const tosLink = termsOfService ? `[Terms of Service](${termsOfService})` : '';
2998
3019
  return contactLink || licenseLink || tosLink ? (React__default.createElement(Panel, { rounded: true, isCollapsible: false, pos: "relative" },
2999
3020
  React__default.createElement(Panel.Titlebar, { bg: "canvas-300" },
package/index.js CHANGED
@@ -136,7 +136,28 @@ const isResolvedObjectProxy = (someObject) => {
136
136
  return !!someObject[originalObjectSymbol];
137
137
  };
138
138
  const getOriginalObject = (resolvedObject) => {
139
- return resolvedObject[originalObjectSymbol] || resolvedObject;
139
+ const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
140
+ if (!originalObject) {
141
+ return resolvedObject;
142
+ }
143
+ const hasAllSchemaErrors = (array) => {
144
+ return array.every(item => item['x-sl-error-message'] !== undefined);
145
+ };
146
+ if (originalObject.anyOf) {
147
+ if (hasAllSchemaErrors(originalObject.anyOf)) {
148
+ return Object.assign(Object.assign({}, originalObject), { anyOf: [originalObject.anyOf] });
149
+ }
150
+ const filteredArray = originalObject.anyOf.filter((item) => !item['x-sl-error-message']);
151
+ return Object.assign(Object.assign({}, originalObject), { anyOf: filteredArray });
152
+ }
153
+ else if (originalObject.oneOf) {
154
+ if (hasAllSchemaErrors(originalObject.oneOf)) {
155
+ return Object.assign(Object.assign({}, originalObject), { oneOf: [originalObject.oneOf] });
156
+ }
157
+ const filteredArray = originalObject.oneOf.filter((item) => !item['x-sl-error-message']);
158
+ return Object.assign(Object.assign({}, originalObject), { oneOf: filteredArray });
159
+ }
160
+ return originalObject;
140
161
  };
141
162
  const isReference = json.hasRef;
142
163
 
@@ -3015,7 +3036,7 @@ const AdditionalInfo = ({ id, termsOfService, contact, license }) => {
3015
3036
  ? `[${license.name}](${licenseUrl})`
3016
3037
  : (license === null || license === void 0 ? void 0 : license.identifier) && licenseUrl
3017
3038
  ? `[${license === null || license === void 0 ? void 0 : license.identifier}](${licenseUrl})`
3018
- : undefined;
3039
+ : '';
3019
3040
  const tosLink = termsOfService ? `[Terms of Service](${termsOfService})` : '';
3020
3041
  return contactLink || licenseLink || tosLink ? (React.createElement(mosaic.Panel, { rounded: true, isCollapsible: false, pos: "relative" },
3021
3042
  React.createElement(mosaic.Panel.Titlebar, { bg: "canvas-300" },
package/index.mjs CHANGED
@@ -114,7 +114,28 @@ const isResolvedObjectProxy = (someObject) => {
114
114
  return !!someObject[originalObjectSymbol];
115
115
  };
116
116
  const getOriginalObject = (resolvedObject) => {
117
- return resolvedObject[originalObjectSymbol] || resolvedObject;
117
+ const originalObject = resolvedObject[originalObjectSymbol] || resolvedObject;
118
+ if (!originalObject) {
119
+ return resolvedObject;
120
+ }
121
+ const hasAllSchemaErrors = (array) => {
122
+ return array.every(item => item['x-sl-error-message'] !== undefined);
123
+ };
124
+ if (originalObject.anyOf) {
125
+ if (hasAllSchemaErrors(originalObject.anyOf)) {
126
+ return Object.assign(Object.assign({}, originalObject), { anyOf: [originalObject.anyOf] });
127
+ }
128
+ const filteredArray = originalObject.anyOf.filter((item) => !item['x-sl-error-message']);
129
+ return Object.assign(Object.assign({}, originalObject), { anyOf: filteredArray });
130
+ }
131
+ else if (originalObject.oneOf) {
132
+ if (hasAllSchemaErrors(originalObject.oneOf)) {
133
+ return Object.assign(Object.assign({}, originalObject), { oneOf: [originalObject.oneOf] });
134
+ }
135
+ const filteredArray = originalObject.oneOf.filter((item) => !item['x-sl-error-message']);
136
+ return Object.assign(Object.assign({}, originalObject), { oneOf: filteredArray });
137
+ }
138
+ return originalObject;
118
139
  };
119
140
  const isReference = hasRef;
120
141
 
@@ -2993,7 +3014,7 @@ const AdditionalInfo = ({ id, termsOfService, contact, license }) => {
2993
3014
  ? `[${license.name}](${licenseUrl})`
2994
3015
  : (license === null || license === void 0 ? void 0 : license.identifier) && licenseUrl
2995
3016
  ? `[${license === null || license === void 0 ? void 0 : license.identifier}](${licenseUrl})`
2996
- : undefined;
3017
+ : '';
2997
3018
  const tosLink = termsOfService ? `[Terms of Service](${termsOfService})` : '';
2998
3019
  return contactLink || licenseLink || tosLink ? (React__default.createElement(Panel, { rounded: true, isCollapsible: false, pos: "relative" },
2999
3020
  React__default.createElement(Panel.Titlebar, { bg: "canvas-300" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "8.4.5",
3
+ "version": "8.4.6",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",