diff --git a/demo/openapi-3-1.yaml b/demo/openapi-3-1.yaml index 7cd6178f9e..f50af26c48 100644 --- a/demo/openapi-3-1.yaml +++ b/demo/openapi-3-1.yaml @@ -1139,6 +1139,7 @@ components: type: [string, integer, 'null'] minItems: 1 maxItems: 10 + default: [] xml: name: photoUrl wrapped: true diff --git a/demo/openapi.yaml b/demo/openapi.yaml index 8cecfd5aba..be7cb578b6 100644 --- a/demo/openapi.yaml +++ b/demo/openapi.yaml @@ -1047,6 +1047,7 @@ components: photoUrls: description: The list of URL to a cute photos featuring pet type: array + default: [] maxItems: 20 xml: name: photoUrl @@ -1176,6 +1177,7 @@ components: name: type: string description: hooray + default: [] description: Pet object that needs to be added to the store required: true UserArray: diff --git a/demo/swagger.yaml b/demo/swagger.yaml index a7552d59f0..5aaa19b60a 100644 --- a/demo/swagger.yaml +++ b/demo/swagger.yaml @@ -780,6 +780,7 @@ definitions: photoUrls: description: The list of URL to a cute photos featuring pet type: array + default: [] xml: name: photoUrl wrapped: true diff --git a/src/components/Markdown/SanitizedMdBlock.tsx b/src/components/Markdown/SanitizedMdBlock.tsx index 44b1d8d4d6..33a54bd01d 100644 --- a/src/components/Markdown/SanitizedMdBlock.tsx +++ b/src/components/Markdown/SanitizedMdBlock.tsx @@ -6,7 +6,7 @@ import { StylingMarkdownProps } from './Markdown'; import { StyledMarkdownBlock } from './styled.elements'; import styled from 'styled-components'; -const StyledMarkdownSpan = styled(StyledMarkdownBlock)` +const StyledMarkdownSpan = styled(props => )` display: inline; `; diff --git a/src/components/__tests__/FieldDetails.test.tsx b/src/components/__tests__/FieldDetails.test.tsx new file mode 100644 index 0000000000..703dc3eabb --- /dev/null +++ b/src/components/__tests__/FieldDetails.test.tsx @@ -0,0 +1,47 @@ +import * as React from 'react'; +import { shallow } from 'enzyme'; + +import { FieldDetails } from '../Fields/FieldDetails'; +import { SchemaModel } from '../../services/models/Schema'; +import { withTheme } from '../testProviders'; + +jest.mock('../ExternalDocumentation/ExternalDocumentation', () => ({ + ExternalDocumentation: () => { + return
; + }, +})); + +describe('FieldDetailsComponent', () => { + it('renders correctly', () => { + const mockFieldProps = { + showExamples: true, + field: { + schema: { + type: 'array', + default: [], + typePrefix: 'test type prefix', + displayType: 'array', + title: 'test title', + externalDocs: undefined, + constraints: [''], + } as SchemaModel, + example: 'example', + name: 'name', + expanded: false, + required: false, + kind: '', + deprecated: false, + collapse: jest.fn(), + toggle: jest.fn(), + explode: false, + expand: jest.fn(), + description: 'test description', + }, + renderDiscriminatorSwitch: jest.fn(), + }; + + const wrapper = shallow(withTheme()); + + expect(wrapper.render()).toMatchSnapshot(); + }); +}); diff --git a/src/components/__tests__/__snapshots__/FieldDetails.test.tsx.snap b/src/components/__tests__/__snapshots__/FieldDetails.test.tsx.snap new file mode 100644 index 0000000000..828cdc8410 --- /dev/null +++ b/src/components/__tests__/__snapshots__/FieldDetails.test.tsx.snap @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`FieldDetailsComponent renders correctly 1`] = ` +
+
+ + test type prefix + + + array + + + (test title) + + + + + + + +
+
+ + Default: + + + + "" + +
+ +
+ + Example: + + + + "example" + +
+
+
+

+ test description +

+ + +
+
+
+`; diff --git a/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap b/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap index 05c900d8ba..b8e1db5037 100644 --- a/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap @@ -3,8 +3,8 @@ exports[`SecurityRequirement should render SecurityDefs 1`] = ` "

petstore_auth

Get access to data while protecting your account credentials. OAuth2 is also a safer and more secure way to give you access.

-
Security Scheme Type: OAuth2
Flow type: implicit
Scopes:
  • write:pets -

    modify pets in your account

    -
  • read:pets -

    read your pets

    +
    Security Scheme Type: OAuth2
    Flow type: implicit
    Scopes:
    • write:pets -

      modify pets in your account

      +
    • read:pets -

      read your pets

GitLab_PersonalAccessToken

GitLab Personal Access Token description

Security Scheme Type: API Key
Header parameter name: PRIVATE-TOKEN

GitLab_OpenIdConnect

GitLab OpenIdConnect description

Security Scheme Type: OpenID Connect

basicAuth

Security Scheme Type: HTTP
HTTP Authorization Scheme: basic
" @@ -15,8 +15,8 @@ exports[`SecurityRequirement should render authDefinition 1`] = `"
Authorizations:
(API Key: GitLab_PersonalAccessTokenOpenID Connect: GitLab_OpenIdConnectHTTP: basicAuth) OAuth2: petstore_auth (write:petsread:pets)
OAuth2: petstore_auth

Get access to data while protecting your account credentials. OAuth2 is also a safer and more secure way to give you access.

-
Flow type: implicit
Required scopes: write:pets read:pets
Scopes:
  • write:pets -

    modify pets in your account

    -
  • read:pets -

    read your pets

    +
    Flow type: implicit
    Required scopes: write:pets read:pets
    Scopes:
    • write:pets -

      modify pets in your account

      +
    • read:pets -

      read your pets

API Key: GitLab_PersonalAccessToken

GitLab Personal Access Token description

Header parameter name: PRIVATE-TOKEN
OpenID Connect: GitLab_OpenIdConnect

GitLab OpenIdConnect description

HTTP: basicAuth
HTTP Authorization Scheme: basic
," diff --git a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap index fce41b1777..1b74faa3a8 100644 --- a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap +++ b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap @@ -33,6 +33,7 @@ Object { "schema": Object { "properties": Object { "name": Object { + "default": Array [], "description": "hooray", "type": "string", }, @@ -289,6 +290,7 @@ Object { "type": "string", }, "photoUrls": Object { + "default": Array [], "description": "The list of URL to a cute photos featuring pet", "items": Object { "format": "url", @@ -2195,6 +2197,7 @@ Object { "type": "string", }, "photoUrls": Object { + "default": Array [], "description": "The list of URL to a cute photos featuring pet", "else": Object { "maxItems": 20, @@ -4085,6 +4088,7 @@ Object { "type": "string", }, "photoUrls": Object { + "default": Array [], "description": "The list of URL to a cute photos featuring pet", "items": Object { "format": "url",