@luvio/model
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -527,2 +527,9 @@ /** | ||
} | ||
// if there is a mapping defined to change the discrimitator value for the current shape, | ||
// use it | ||
const ids = Array.from(resolveShapeIds(this.shape)); | ||
const discriminatorValueMapping = discriminatedParent.shape.discriminatorValueMapping.find((mapping) => Array.from(resolveShapeIds(mapping.targetShape)).filter((mappingId) => ids.includes(mappingId)).length > 0); | ||
if (discriminatorValueMapping) { | ||
discriminatorValue = discriminatorValueMapping.value.value(); | ||
} | ||
if (discriminatorValue !== undefined) { | ||
@@ -986,2 +993,2 @@ if (discriminatedParent.discriminatorValueMapping.find((element) => element.value === discriminatorValue) !== undefined) { | ||
export { AMFAnyTypeImpl, AMFArrayTypeImpl, AMFBooleanTypeImpl, AMFDateTimeImpl, AMFDateTimeOnlyTypeImpl, AMFDateTypeImpl, AMFDoubleTypeImpl, AMFEnumerableScalarType, AMFIntegerTypeImpl, AMFNilTypeImpl, AMFNumberTypeImpl, AMFObjectTypeImpl, AMFStringTypeImpl, AMFTimeTypeImpl, AMFUnionTypeImpl, BaseTypeRegistry, DiscriminatorValueTypes, amfTypeFactory, getDiscriminatedParent, parseUrl }; | ||
export { AMFAnyTypeImpl, AMFArrayTypeImpl, AMFBooleanTypeImpl, AMFDateTimeImpl, AMFDateTimeOnlyTypeImpl, AMFDateTypeImpl, AMFDoubleTypeImpl, AMFEnumerableScalarType, AMFIntegerTypeImpl, AMFNilTypeImpl, AMFNumberTypeImpl, AMFObjectTypeImpl, AMFStringTypeImpl, AMFTimeTypeImpl, AMFUnionTypeImpl, BaseTypeRegistry, DiscriminatorValueTypes, amfTypeFactory, getDiscriminatedParent, parseUrl, resolveShapeIds }; |
@@ -0,3 +1,3 @@ | ||
import { type AMFTypeProps } from '.'; | ||
import { AMFBaseType } from './AMFBaseType'; | ||
import type { AMFTypeProps } from '.'; | ||
import type * as amf from 'amf-client-js'; | ||
@@ -4,0 +4,0 @@ import type { DiscriminatorValue, PatternProperty, Property, ObjectType, Type } from '../../Type'; |
@@ -17,2 +17,7 @@ import amf from 'amf-client-js'; | ||
export declare function amfTypeFactory(shape: amf.Shape, typeRegistry: TypeRegistry<AMFType>, logger: FileParserLogger, resolve?: boolean, propertyName?: string): AMFType; | ||
/** | ||
* Returns the AMF Shape ids that are equivalent to the specified Shape via | ||
* various forms of references within the AMF model. | ||
*/ | ||
export declare function resolveShapeIds(shape: amf.Shape, propertyName?: string): Set<string>; | ||
export type AMFTypeFactory = typeof amfTypeFactory; |
@@ -1,8 +0,12 @@ | ||
import type { ScalarType, Type } from './Type'; | ||
import type { ArrayType, ScalarType, Type } from './Type'; | ||
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'CONNECT' | 'OPTIONS' | 'TRACE'; | ||
export type StatusCode = '100' | '101' | '102' | '103' | '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' | '300' | '301' | '302' | '303' | '304' | '305' | '306' | '307' | '308' | '400' | '401' | '402' | '403' | '404' | '405' | '406' | '407' | '408' | '409' | '410' | '411' | '412' | '413' | '414' | '415' | '416' | '417' | '418' | '421' | '422' | '423' | '424' | '425' | '426' | '428' | '429' | '431' | '451' | '500' | '501' | '502' | '503' | '504' | '505' | '506' | '507' | '508' | '510' | '511'; | ||
export type Parameter = { | ||
type: ScalarType; | ||
export type Parameter<T = ScalarType> = { | ||
type: T; | ||
required: boolean; | ||
}; | ||
export type QueryParameter = Parameter<ScalarType | (ArrayType & { | ||
items?: ScalarType; | ||
})>; | ||
export type TypeOfParameter<P> = P extends Parameter<infer T> ? T : never; | ||
export type ApplicationJsonContent<T extends Type> = { | ||
@@ -18,3 +22,3 @@ mediaType: 'application/json'; | ||
export type Request<T extends Type = Type> = { | ||
queryParameters: Record<string, Parameter>; | ||
queryParameters: Record<string, QueryParameter>; | ||
uriParameters: Record<string, Parameter>; | ||
@@ -21,0 +25,0 @@ payloads: Array<Payload<T>>; |
{ | ||
"name": "@luvio/model", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Luvio model", | ||
@@ -27,3 +27,3 @@ "repository": { | ||
"devDependencies": { | ||
"@luvio/utils": "^5.1.0" | ||
"@luvio/utils": "^5.2.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "volta": { |
60656
1459