Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ns-json-schema-draft-7): remove explicit Fallback visitors #4070

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,14 @@ import { pipe, assocPath, dissocPath } from 'ramda';
import { specificationObj } from '@swagger-api/apidom-ns-json-schema-draft-6';

import JSONSchemaVisitor from './visitors/json-schema';
import JSONSchema$commentVisitor from './visitors/json-schema/$commentVisitor';
import JsonSchemaContentEncodingVisitor from './visitors/json-schema/ContentEncodingVisitor';
import JsonSchemaContentMediaTypeVisitor from './visitors/json-schema/ContentMediaTypeVisitor';
import JsonSchemaWriteOnlyVisitor from './visitors/json-schema/WriteOnlyVisitor';
import LinkDescriptionVisitor from './visitors/json-schema/link-description';
import LinkDescriptionAnchorVisitor from './visitors/json-schema/link-description/AnchorVisitor';
import LinkDescriptionAnchorPointerVisitor from './visitors/json-schema/link-description/AnchorPointerVisitor';
import LinkDescriptionTargetMediaTypeVisitor from './visitors/json-schema/link-description/TargetMediaTypeVisitor';
import LinkDescriptionTargetHintsVisitor from './visitors/json-schema/link-description/TargetHintsVisitor';
import LinkDescriptionDescriptionVisitor from './visitors/json-schema/link-description/DescriptionVisitor';
import LinkDescription$commentVisitor from './visitors/json-schema/link-description/$commentVisitor';
import LinkDescriptionSubmissionMediaTypeVisitor from './visitors/json-schema/link-description/SubmissionMediaTypeVisitor';

const specification = pipe(
// JSON Schema object modifications
assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor),
assocPath(
['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$comment'],
JSONSchema$commentVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'if'],
Expand All @@ -37,15 +26,15 @@ const specification = pipe(
dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'media']),
assocPath(
['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentEncoding'],
JsonSchemaContentEncodingVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contentMediaType'],
JsonSchemaContentMediaTypeVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'writeOnly'],
JsonSchemaWriteOnlyVisitor,
specificationObj.visitors.value,
),
// Link Description object modifications
assocPath(
Expand All @@ -54,28 +43,28 @@ const specification = pipe(
),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'anchor'],
LinkDescriptionAnchorVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'anchorPointer'],
LinkDescriptionAnchorPointerVisitor,
specificationObj.visitors.value,
),
dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'mediaType']),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetMediaType'],
LinkDescriptionTargetMediaTypeVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'targetHints'],
LinkDescriptionTargetHintsVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'description'],
LinkDescriptionDescriptionVisitor,
specificationObj.visitors.value,
),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', '$comment'],
LinkDescription$commentVisitor,
specificationObj.visitors.value,
),
dissocPath([
'visitors',
Expand All @@ -87,7 +76,7 @@ const specification = pipe(
]),
assocPath(
['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionMediaType'],
LinkDescriptionSubmissionMediaTypeVisitor,
specificationObj.visitors.value,
),
)(specificationObj);

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.