-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #60
- Loading branch information
Showing
19 changed files
with
848 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
recursive: true, | ||
spec: 'test/**/*.ts', | ||
require: ['test/mocha-bootstrap.js'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apidom/packages/apidom-ns-openapi3-1/src/elements/Components.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apidom/packages/apidom-ns-openapi3-1/src/elements/ServerVariable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export { default } from './namespace'; | ||
|
||
export { | ||
isRefElement, | ||
isLinkElement, | ||
isMemberElement, | ||
isObjectElement, | ||
isArrayElement, | ||
isBooleanElement, | ||
isNullElement, | ||
isElement, | ||
isNumberElement, | ||
isStringElement, | ||
} from 'apidom'; | ||
|
||
export { | ||
isOpenApiApi3_1Element, | ||
isContactElement, | ||
isLicenseElement, | ||
isInfoElement, | ||
isComponentsElement, | ||
isSchemaElement, | ||
isOpenapiElement, | ||
isServerElement, | ||
isServerVariableElement, | ||
} from './predicates'; | ||
|
||
export { default as ComponentsElement } from './elements/Components'; | ||
export { default as ContactElement } from './elements/Contact'; | ||
export { default as InfoElement } from './elements/Info'; | ||
export { default as LicenseElement } from './elements/License'; | ||
export { default as OpenapiElement } from './elements/Openapi'; | ||
export { default as OpenApi3_1Element } from './elements/OpenApi3-1'; | ||
export { default as SchemaElement } from './elements/Schema'; | ||
export { default as ServerElement } from './elements/Server'; | ||
export { default as ServerVariableElement } from './elements/ServerVariable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
import { allPass, either, is } from 'ramda'; | ||
import { createPredicate } from 'apidom'; | ||
|
||
import ComponentsElement from './elements/Components'; | ||
import ContactElement from './elements/Contact'; | ||
import InfoElement from './elements/Info'; | ||
import LicenseElement from './elements/License'; | ||
import OpenapiElement from './elements/Openapi'; | ||
import OpenApi3_1Element from './elements/OpenApi3-1'; | ||
import SchemaElement from './elements/Schema'; | ||
import ServerElement from './elements/Server'; | ||
import ServerVariableElement from './elements/ServerVariable'; | ||
|
||
export const isOpenApiApi3_1Element = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter, hasClass }) => { | ||
const isElementTypeOpenApi3_1 = isElementType('openApi3-1'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasClassApi = hasClass('api'); | ||
const hasGetterOpenapi = hasGetter('openapi'); | ||
const hasGetterInfo = hasGetter('info'); | ||
const hasGetterServers = hasGetter('servers'); | ||
const hasGetterComponents = hasGetter('components'); | ||
|
||
return either( | ||
is(OpenApi3_1Element), | ||
allPass([ | ||
hasBasicElementProps, | ||
isElementTypeOpenApi3_1, | ||
primitiveEqObject, | ||
hasClassApi, | ||
hasGetterOpenapi, | ||
hasGetterInfo, | ||
hasGetterServers, | ||
hasGetterComponents, | ||
]), | ||
); | ||
}, | ||
); | ||
|
||
export const isOpenapiElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeOpenapi = isElementType('openapi'); | ||
const primitiveEqString = primitiveEq('string'); | ||
const hasGetterLength = hasGetter('length'); | ||
|
||
return either( | ||
is(OpenapiElement), | ||
allPass([hasBasicElementProps, isElementTypeOpenapi, primitiveEqString, hasGetterLength]), | ||
); | ||
}, | ||
); | ||
|
||
export const isInfoElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeInfo = isElementType('info'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasGetterTitle = hasGetter('title'); | ||
const hasGetterDescription = hasGetter('description'); | ||
const hasGetterSummary = hasGetter('summary'); | ||
const hasGetterTermsOfService = hasGetter('termsOfService'); | ||
const hasGetterVersion = hasGetter('version'); | ||
const hasGetterLicense = hasGetter('license'); | ||
const hasGetterContact = hasGetter('contact'); | ||
|
||
return either( | ||
is(InfoElement), | ||
allPass([ | ||
hasBasicElementProps, | ||
isElementTypeInfo, | ||
primitiveEqObject, | ||
hasGetterTitle, | ||
hasGetterDescription, | ||
hasGetterSummary, | ||
hasGetterTermsOfService, | ||
hasGetterVersion, | ||
hasGetterLicense, | ||
hasGetterContact, | ||
]), | ||
); | ||
}, | ||
); | ||
|
||
export const isLicenseElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeLicense = isElementType('license'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasGetterName = hasGetter('name'); | ||
const hasGetterIdentifier = hasGetter('identifier'); | ||
const hasGetterUrl = hasGetter('url'); | ||
|
||
return either( | ||
is(LicenseElement), | ||
allPass([ | ||
hasBasicElementProps, | ||
isElementTypeLicense, | ||
primitiveEqObject, | ||
hasGetterName, | ||
hasGetterIdentifier, | ||
hasGetterUrl, | ||
]), | ||
); | ||
}, | ||
); | ||
|
||
export const isContactElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeContact = isElementType('contact'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasGetterName = hasGetter('name'); | ||
const hasGetterUrl = hasGetter('url'); | ||
const hasGetterEmail = hasGetter('email'); | ||
|
||
return either( | ||
is(ContactElement), | ||
allPass([ | ||
hasBasicElementProps, | ||
isElementTypeContact, | ||
primitiveEqObject, | ||
hasGetterName, | ||
hasGetterUrl, | ||
hasGetterEmail, | ||
]), | ||
); | ||
}, | ||
); | ||
|
||
export const isComponentsElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeInfo = isElementType('components'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasGetterSchemes = hasGetter('schemas'); | ||
|
||
return either( | ||
is(ComponentsElement), | ||
allPass([hasBasicElementProps, isElementTypeInfo, primitiveEqObject, hasGetterSchemes]), | ||
); | ||
}, | ||
); | ||
|
||
export const isSchemaElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq }) => { | ||
const isElementTypeInfo = isElementType('schema'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
|
||
return either( | ||
is(SchemaElement), | ||
allPass([hasBasicElementProps, isElementTypeInfo, primitiveEqObject]), | ||
); | ||
}, | ||
); | ||
|
||
export const isServerElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeInfo = isElementType('server'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasGetterUrl = hasGetter('url'); | ||
const hasGetterDescription = hasGetter('description'); | ||
const hasGetterVariables = hasGetter('variables'); | ||
|
||
return either( | ||
is(ServerElement), | ||
allPass([ | ||
hasBasicElementProps, | ||
isElementTypeInfo, | ||
primitiveEqObject, | ||
hasGetterUrl, | ||
hasGetterDescription, | ||
hasGetterVariables, | ||
]), | ||
); | ||
}, | ||
); | ||
|
||
export const isServerVariableElement = createPredicate( | ||
({ hasBasicElementProps, isElementType, primitiveEq, hasGetter }) => { | ||
const isElementTypeInfo = isElementType('serverVariable'); | ||
const primitiveEqObject = primitiveEq('object'); | ||
const hasGetterDefault = hasGetter('default'); | ||
const hasGetterDescription = hasGetter('description'); | ||
const hasGetterEnum = hasGetter('enum'); | ||
|
||
return either( | ||
is(ServerVariableElement), | ||
allPass([ | ||
hasBasicElementProps, | ||
isElementTypeInfo, | ||
primitiveEqObject, | ||
hasGetterDefault, | ||
hasGetterDescription, | ||
hasGetterEnum, | ||
]), | ||
); | ||
}, | ||
); |
Oops, something went wrong.