
package.es.refractor.predicates.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apidom-ns-asyncapi-2 Show documentation
Show all versions of apidom-ns-asyncapi-2 Show documentation
AsyncAPI 2.x.y namespace for ApiDOM.
import { startsWith } from 'ramda';
import { isStringElement, isObjectElement, toValue } from '@swagger-api/apidom-core';
export const isAsyncApi2LikeElement = element => {
return isObjectElement(element) &&
// @ts-ignore
element.hasKey('asyncapi') &&
// @ts-ignore
element.hasKey('info') &&
// @ts-ignore
element.hasKey('channels');
};
export const isParameterLikeElement = element => {
// @ts-ignore
return isObjectElement(element);
};
export const isReferenceLikeElement = element => {
// @ts-ignore
return isObjectElement(element) && element.hasKey('$ref');
};
export const isSchemaLikeElement = element => {
// @ts-ignore
return isObjectElement(element);
};
export const isSecurityRequirementLikeElement = element => {
return isObjectElement(element);
};
export const isServerLikeElement = element => {
// @ts-ignore
return isObjectElement(element) && element.hasKey('url') && element.hasKey('protocol');
};
export const isAsyncApiExtension = element => {
// @ts-ignore
return isStringElement(element.key) && startsWith('x-', toValue(element.key));
};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy