fork of hey-api/openapi-ts because I need some additional things

Merge pull request #1267 from hey-api/fix/experimental-parser-discriminator

fix: handle discriminators in experimental parser

authored by Lubos and committed by GitHub 8b46fe62 04c88dd4

Changed files
+1103 -351
.changeset
packages
openapi-ts
src
ir
openApi
3.0.x
3.1.x
shared
plugins
@hey-api
schemas
utils
test
__snapshots__
3.0.x
discriminator-all-of
discriminator-any-of
discriminator-one-of
plugins
@hey-api
services
default
@tanstack
angular-query-experimental
asClass
axios
fetch
react-query
asClass
axios
fetch
solid-query
asClass
axios
fetch
svelte-query
asClass
axios
fetch
vue-query
asClass
axios
fetch
3.1.x
discriminator-all-of
discriminator-any-of
discriminator-one-of
plugins
@hey-api
services
default
@tanstack
angular-query-experimental
asClass
axios
fetch
react-query
asClass
axios
fetch
solid-query
asClass
axios
fetch
svelte-query
asClass
axios
fetch
vue-query
asClass
axios
fetch
spec
+5
.changeset/shiny-bears-double.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix: handle discriminators in experimental parser
+1 -1
packages/openapi-ts/src/index.ts
··· 283 283 const absolutePathOrUrl = existsSync(config.input.path) 284 284 ? path.resolve(config.input.path) 285 285 : config.input.path; 286 - spec = await $RefParser.bundle(absolutePathOrUrl, absolutePathOrUrl, {}); 286 + spec = await $RefParser.bundle(absolutePathOrUrl); 287 287 } 288 288 289 289 return spec;
+19
packages/openapi-ts/src/ir/context.ts
··· 21 21 } 22 22 23 23 export class IRContext<Spec extends Record<string, any> = any> { 24 + /** 25 + * Configuration for parsing and generating the output. This 26 + * is a mix of user-provided and default values. 27 + */ 24 28 public config: Config; 29 + /** 30 + * A map of files that will be generated from `spec`. 31 + */ 25 32 public files: Files; 33 + /** 34 + * Intermediate representation model obtained from `spec`. 35 + */ 26 36 public ir: IR; 27 37 public parserConfig: ParserConfig; 38 + /** 39 + * Resolved specification from `input`. 40 + */ 28 41 public spec: Spec; 29 42 30 43 constructor({ ··· 62 75 return createdFile; 63 76 } 64 77 78 + /** 79 + * Returns a specific file by ID from `files`. 80 + */ 65 81 public file({ id }: Pick<ContextFile, 'id'>): TypeScriptFile | undefined { 66 82 return this.files[id]; 67 83 } ··· 77 93 }); 78 94 } 79 95 96 + /** 97 + * Returns a resolved reference from `spec`. 98 + */ 80 99 public resolveRef<T>($ref: string) { 81 100 return resolveRef<T>({ 82 101 $ref,
+6
packages/openapi-ts/src/ir/schema.ts
··· 17 17 18 18 for (const item of schema.items) { 19 19 // skip nested schemas for now, handle if necessary 20 + if (!item.type && item.items) { 21 + uniqueItems.push(item); 22 + continue; 23 + } 24 + 20 25 if ( 26 + // no `type` might still include `$ref` or `const` 21 27 !item.type || 22 28 item.type === 'boolean' || 23 29 item.type === 'null' ||
+1 -1
packages/openapi-ts/src/openApi/3.0.x/parser/index.ts
··· 238 238 const schema = context.spec.components.schemas[name]; 239 239 240 240 parseSchema({ 241 + $ref, 241 242 context, 242 - name, 243 243 schema, 244 244 }); 245 245 }
+116 -63
packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts
··· 1 1 import type { IRContext } from '../../../ir/context'; 2 2 import type { IRSchemaObject } from '../../../ir/ir'; 3 3 import { addItemsToSchema } from '../../../ir/utils'; 4 + import { refToName } from '../../../utils/ref'; 5 + import { discriminatorValue } from '../../shared/utils/discriminator'; 4 6 import type { ReferenceObject, SchemaObject } from '../types/spec'; 7 + 8 + interface SchemaContext { 9 + /** 10 + * Optional schema $ref. This will be only defined for reusable components 11 + * from the OpenAPI specification. 12 + */ 13 + $ref?: string; 14 + context: IRContext; 15 + } 5 16 6 17 type SchemaWithRequired<K extends keyof Required<SchemaObject>> = Omit< 7 18 SchemaObject, ··· 52 63 context, 53 64 irSchema = {}, 54 65 schema, 55 - }: { 56 - context: IRContext; 66 + }: SchemaContext & { 57 67 irSchema?: IRSchemaObject; 58 68 schema: SchemaObject; 59 69 }): IRSchemaObject => { ··· 106 116 107 117 const parseBoolean = ({ 108 118 irSchema = {}, 109 - }: { 110 - context: IRContext; 119 + }: SchemaContext & { 111 120 irSchema?: IRSchemaObject; 112 121 schema: SchemaObject; 113 122 }): IRSchemaObject => { ··· 118 127 119 128 const parseNumber = ({ 120 129 irSchema = {}, 121 - }: { 122 - context: IRContext; 130 + }: SchemaContext & { 123 131 irSchema?: IRSchemaObject; 124 132 schema: SchemaObject; 125 133 }): IRSchemaObject => { ··· 132 140 context, 133 141 irSchema = {}, 134 142 schema, 135 - }: { 136 - context: IRContext; 143 + }: SchemaContext & { 137 144 irSchema?: IRSchemaObject; 138 145 schema: SchemaObject; 139 146 }): IRSchemaObject => { ··· 186 193 187 194 const parseString = ({ 188 195 irSchema = {}, 189 - }: { 190 - context: IRContext; 196 + }: SchemaContext & { 191 197 irSchema?: IRSchemaObject; 192 198 schema: SchemaObject; 193 199 }): IRSchemaObject => { ··· 224 230 }; 225 231 226 232 const parseAllOf = ({ 233 + $ref, 227 234 context, 228 235 schema, 229 - }: { 230 - context: IRContext; 236 + }: SchemaContext & { 231 237 schema: SchemaWithRequired<'allOf'>; 232 238 }): IRSchemaObject => { 233 239 let irSchema = initIrSchema({ schema }); ··· 244 250 schema: compositionSchema, 245 251 }), 246 252 ); 253 + 254 + if ('$ref' in compositionSchema) { 255 + const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref); 256 + // `$ref` should be passed from the root `parseSchema()` call 257 + if (ref.discriminator && $ref) { 258 + const irDiscriminatorSchema: IRSchemaObject = { 259 + properties: { 260 + [ref.discriminator.propertyName]: { 261 + const: discriminatorValue($ref, ref.discriminator.mapping), 262 + type: 'string', 263 + }, 264 + }, 265 + type: 'object', 266 + }; 267 + schemaItems.push(irDiscriminatorSchema); 268 + } 269 + } 247 270 } 248 271 249 272 if (schemaType === 'object') { ··· 326 349 } 327 350 } 328 351 329 - if (schema.discriminator) { 330 - // TODO: parser - support discriminator 331 - // TODO: parser - maybe abstract discriminator from oneOf, anyOf, and allOf 332 - } 333 - 334 352 return irSchema; 335 353 }; 336 354 337 355 const parseAnyOf = ({ 338 356 context, 339 357 schema, 340 - }: { 341 - context: IRContext; 358 + }: SchemaContext & { 342 359 schema: SchemaWithRequired<'anyOf'>; 343 360 }): IRSchemaObject => { 344 361 let irSchema = initIrSchema({ schema }); ··· 346 363 const schemaItems: Array<IRSchemaObject> = []; 347 364 const schemaType = getSchemaType({ schema }); 348 365 349 - for (const anyOf of schema.anyOf) { 350 - schemaItems.push( 351 - schemaToIrSchema({ 352 - context, 353 - schema: anyOf, 354 - }), 355 - ); 366 + const compositionSchemas = schema.anyOf; 367 + 368 + for (const compositionSchema of compositionSchemas) { 369 + let irCompositionSchema = schemaToIrSchema({ 370 + context, 371 + schema: compositionSchema, 372 + }); 373 + 374 + // `$ref` should be defined with discriminators 375 + if (schema.discriminator && '$ref' in compositionSchema) { 376 + const irDiscriminatorSchema: IRSchemaObject = { 377 + properties: { 378 + [schema.discriminator.propertyName]: { 379 + const: discriminatorValue( 380 + compositionSchema.$ref, 381 + schema.discriminator.mapping, 382 + ), 383 + type: 'string', 384 + }, 385 + }, 386 + type: 'object', 387 + }; 388 + irCompositionSchema = { 389 + items: [irDiscriminatorSchema, irCompositionSchema], 390 + logicalOperator: 'and', 391 + }; 392 + } 393 + 394 + schemaItems.push(irCompositionSchema); 356 395 } 357 396 358 397 if (schema.nullable) { ··· 383 422 } 384 423 } 385 424 386 - if (schema.discriminator) { 387 - // TODO: parser - support discriminator 388 - // TODO: parser - maybe abstract discriminator from oneOf, anyOf, and allOf 389 - } 390 - 391 425 return irSchema; 392 426 }; 393 427 394 428 const parseEnum = ({ 395 429 context, 396 430 schema, 397 - }: { 398 - context: IRContext; 431 + }: SchemaContext & { 399 432 schema: SchemaWithRequired<'enum'>; 400 433 }): IRSchemaObject => { 401 434 let irSchema = initIrSchema({ schema }); ··· 463 496 const parseOneOf = ({ 464 497 context, 465 498 schema, 466 - }: { 467 - context: IRContext; 499 + }: SchemaContext & { 468 500 schema: SchemaWithRequired<'oneOf'>; 469 501 }): IRSchemaObject => { 470 502 let irSchema = initIrSchema({ schema }); ··· 472 504 let schemaItems: Array<IRSchemaObject> = []; 473 505 const schemaType = getSchemaType({ schema }); 474 506 475 - for (const oneOf of schema.oneOf) { 476 - const irOneOfSchema = schemaToIrSchema({ 507 + const compositionSchemas = schema.oneOf; 508 + 509 + for (const compositionSchema of compositionSchemas) { 510 + let irCompositionSchema = schemaToIrSchema({ 477 511 context, 478 - schema: oneOf, 512 + schema: compositionSchema, 479 513 }); 480 514 515 + // `$ref` should be defined with discriminators 516 + if (schema.discriminator && '$ref' in compositionSchema) { 517 + const irDiscriminatorSchema: IRSchemaObject = { 518 + properties: { 519 + [schema.discriminator.propertyName]: { 520 + const: discriminatorValue( 521 + compositionSchema.$ref, 522 + schema.discriminator.mapping, 523 + ), 524 + type: 'string', 525 + }, 526 + }, 527 + type: 'object', 528 + }; 529 + irCompositionSchema = { 530 + items: [irDiscriminatorSchema, irCompositionSchema], 531 + logicalOperator: 'and', 532 + }; 533 + } 534 + 481 535 // since we know oneOf will be using "or" logical operator, if the parsed 482 536 // composition schema also has an "or" operator, we can bring it up 483 537 // to avoid unnecessary brackets 484 - if (irOneOfSchema.logicalOperator === 'or' && irOneOfSchema.items) { 485 - schemaItems = schemaItems.concat(irOneOfSchema.items); 538 + if ( 539 + irCompositionSchema.logicalOperator === 'or' && 540 + irCompositionSchema.items 541 + ) { 542 + schemaItems = schemaItems.concat(irCompositionSchema.items); 486 543 } else { 487 - schemaItems.push(irOneOfSchema); 544 + schemaItems.push(irCompositionSchema); 488 545 } 489 546 } 490 547 ··· 516 573 } 517 574 } 518 575 519 - if (schema.discriminator) { 520 - // TODO: parser - support discriminator 521 - // TODO: parser - maybe abstract discriminator from oneOf, anyOf, and allOf 522 - } 523 - 524 576 return irSchema; 525 577 }; 526 578 527 579 const parseRef = ({ 528 580 schema, 529 - }: { 530 - context: IRContext; 581 + }: SchemaContext & { 531 582 schema: ReferenceObject; 532 583 }): IRSchemaObject => { 533 584 const irSchema: IRSchemaObject = {}; ··· 543 594 context, 544 595 irSchema, 545 596 schema, 546 - }: { 547 - context: IRContext; 597 + }: SchemaContext & { 548 598 irSchema?: IRSchemaObject; 549 599 schema: SchemaWithRequired<'type'>; 550 600 }): IRSchemaObject => { ··· 579 629 const parseType = ({ 580 630 context, 581 631 schema, 582 - }: { 583 - context: IRContext; 632 + }: SchemaContext & { 584 633 schema: SchemaWithRequired<'type'>; 585 634 }): IRSchemaObject => { 586 635 const irSchema = initIrSchema({ schema }); ··· 621 670 context, 622 671 irSchema, 623 672 schema, 624 - }: { 625 - context: IRContext; 673 + }: SchemaContext & { 626 674 irSchema?: IRSchemaObject; 627 675 schema: SchemaWithRequired<'type'>; 628 676 }): IRSchemaObject => { ··· 672 720 673 721 const parseUnknown = ({ 674 722 schema, 675 - }: { 676 - context: IRContext; 723 + }: SchemaContext & { 677 724 schema: SchemaObject; 678 725 }): IRSchemaObject => { 679 726 const irSchema = initIrSchema({ schema }); ··· 689 736 }; 690 737 691 738 export const schemaToIrSchema = ({ 739 + $ref, 692 740 context, 693 741 schema, 694 - }: { 695 - context: IRContext; 742 + }: SchemaContext & { 696 743 schema: SchemaObject | ReferenceObject; 697 744 }): IRSchemaObject => { 698 745 if ('$ref' in schema) { 699 746 return parseRef({ 747 + $ref, 700 748 context, 701 749 schema, 702 750 }); ··· 704 752 705 753 if (schema.enum) { 706 754 return parseEnum({ 755 + $ref, 707 756 context, 708 757 schema: schema as SchemaWithRequired<'enum'>, 709 758 }); ··· 711 760 712 761 if (schema.allOf) { 713 762 return parseAllOf({ 763 + $ref, 714 764 context, 715 765 schema: schema as SchemaWithRequired<'allOf'>, 716 766 }); ··· 718 768 719 769 if (schema.anyOf) { 720 770 return parseAnyOf({ 771 + $ref, 721 772 context, 722 773 schema: schema as SchemaWithRequired<'anyOf'>, 723 774 }); ··· 725 776 726 777 if (schema.oneOf) { 727 778 return parseOneOf({ 779 + $ref, 728 780 context, 729 781 schema: schema as SchemaWithRequired<'oneOf'>, 730 782 }); ··· 733 785 // infer object based on the presence of properties 734 786 if (schema.type || schema.properties) { 735 787 return parseType({ 788 + $ref, 736 789 context, 737 790 schema: schema as SchemaWithRequired<'type'>, 738 791 }); 739 792 } 740 793 741 794 return parseUnknown({ 795 + $ref, 742 796 context, 743 797 schema, 744 798 }); 745 799 }; 746 800 747 801 export const parseSchema = ({ 802 + $ref, 748 803 context, 749 - name, 750 804 schema, 751 - }: { 752 - context: IRContext; 753 - name: string; 805 + }: Required<SchemaContext> & { 754 806 schema: SchemaObject | ReferenceObject; 755 807 }) => { 756 808 if (!context.ir.components) { ··· 761 813 context.ir.components.schemas = {}; 762 814 } 763 815 764 - context.ir.components.schemas[name] = schemaToIrSchema({ 816 + context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({ 817 + $ref, 765 818 context, 766 819 schema, 767 820 });
+1 -1
packages/openapi-ts/src/openApi/3.1.x/parser/index.ts
··· 231 231 const schema = context.spec.components.schemas[name]; 232 232 233 233 parseSchema({ 234 + $ref, 234 235 context, 235 - name, 236 236 schema, 237 237 }); 238 238 }
+117 -65
packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts
··· 1 1 import type { IRContext } from '../../../ir/context'; 2 2 import type { IRSchemaObject } from '../../../ir/ir'; 3 3 import { addItemsToSchema } from '../../../ir/utils'; 4 + import { refToName } from '../../../utils/ref'; 5 + import { discriminatorValue } from '../../shared/utils/discriminator'; 4 6 import type { SchemaObject } from '../types/spec'; 7 + 8 + interface SchemaContext { 9 + /** 10 + * Optional schema $ref. This will be only defined for reusable components 11 + * from the OpenAPI specification. 12 + */ 13 + $ref?: string; 14 + context: IRContext; 15 + } 5 16 6 17 type SchemaWithRequired<K extends keyof Required<SchemaObject>> = Omit< 7 18 SchemaObject, ··· 82 93 context, 83 94 irSchema = {}, 84 95 schema, 85 - }: { 86 - context: IRContext; 96 + }: SchemaContext & { 87 97 irSchema?: IRSchemaObject; 88 98 schema: SchemaObject; 89 99 }): IRSchemaObject => { ··· 148 158 149 159 const parseBoolean = ({ 150 160 irSchema = {}, 151 - }: { 152 - context: IRContext; 161 + }: SchemaContext & { 153 162 irSchema?: IRSchemaObject; 154 163 schema: SchemaObject; 155 164 }): IRSchemaObject => { ··· 160 169 161 170 const parseNull = ({ 162 171 irSchema = {}, 163 - }: { 164 - context: IRContext; 172 + }: SchemaContext & { 165 173 irSchema?: IRSchemaObject; 166 174 schema: SchemaObject; 167 175 }) => { ··· 172 180 173 181 const parseNumber = ({ 174 182 irSchema = {}, 175 - }: { 176 - context: IRContext; 183 + }: SchemaContext & { 177 184 irSchema?: IRSchemaObject; 178 185 schema: SchemaObject; 179 186 }): IRSchemaObject => { ··· 186 193 context, 187 194 irSchema = {}, 188 195 schema, 189 - }: { 190 - context: IRContext; 196 + }: SchemaContext & { 191 197 irSchema?: IRSchemaObject; 192 198 schema: SchemaObject; 193 199 }): IRSchemaObject => { ··· 240 246 241 247 const parseString = ({ 242 248 irSchema = {}, 243 - }: { 244 - context: IRContext; 249 + }: SchemaContext & { 245 250 irSchema?: IRSchemaObject; 246 251 schema: SchemaObject; 247 252 }): IRSchemaObject => { ··· 278 283 }; 279 284 280 285 const parseAllOf = ({ 286 + $ref, 281 287 context, 282 288 schema, 283 - }: { 284 - context: IRContext; 289 + }: SchemaContext & { 285 290 schema: SchemaWithRequired<'allOf'>; 286 291 }): IRSchemaObject => { 287 292 let irSchema = initIrSchema({ schema }); ··· 298 303 schema: compositionSchema, 299 304 }), 300 305 ); 306 + 307 + if (compositionSchema.$ref) { 308 + const ref = context.resolveRef<SchemaObject>(compositionSchema.$ref); 309 + // `$ref` should be passed from the root `parseSchema()` call 310 + if (ref.discriminator && $ref) { 311 + const irDiscriminatorSchema: IRSchemaObject = { 312 + properties: { 313 + [ref.discriminator.propertyName]: { 314 + const: discriminatorValue($ref, ref.discriminator.mapping), 315 + type: 'string', 316 + }, 317 + }, 318 + type: 'object', 319 + }; 320 + schemaItems.push(irDiscriminatorSchema); 321 + } 322 + } 301 323 } 302 324 303 325 if (schemaTypes.includes('object')) { ··· 369 391 }; 370 392 } 371 393 372 - if (schema.discriminator) { 373 - // TODO: parser - support discriminator 374 - // TODO: parser - maybe abstract discriminator from oneOf, anyOf, and allOf 375 - } 376 - 377 394 return irSchema; 378 395 }; 379 396 380 397 const parseAnyOf = ({ 381 398 context, 382 399 schema, 383 - }: { 384 - context: IRContext; 400 + }: SchemaContext & { 385 401 schema: SchemaWithRequired<'anyOf'>; 386 402 }): IRSchemaObject => { 387 403 let irSchema = initIrSchema({ schema }); ··· 389 405 const schemaItems: Array<IRSchemaObject> = []; 390 406 const schemaTypes = getSchemaTypes({ schema }); 391 407 392 - for (const anyOf of schema.anyOf) { 393 - schemaItems.push( 394 - schemaToIrSchema({ 395 - context, 396 - schema: anyOf, 397 - }), 398 - ); 408 + const compositionSchemas = schema.anyOf; 409 + 410 + for (const compositionSchema of compositionSchemas) { 411 + let irCompositionSchema = schemaToIrSchema({ 412 + context, 413 + schema: compositionSchema, 414 + }); 415 + 416 + // `$ref` should be defined with discriminators 417 + if (schema.discriminator && compositionSchema.$ref) { 418 + const irDiscriminatorSchema: IRSchemaObject = { 419 + properties: { 420 + [schema.discriminator.propertyName]: { 421 + const: discriminatorValue( 422 + compositionSchema.$ref, 423 + schema.discriminator.mapping, 424 + ), 425 + type: 'string', 426 + }, 427 + }, 428 + type: 'object', 429 + }; 430 + irCompositionSchema = { 431 + items: [irDiscriminatorSchema, irCompositionSchema], 432 + logicalOperator: 'and', 433 + }; 434 + } 435 + 436 + schemaItems.push(irCompositionSchema); 399 437 } 400 438 401 439 if (schemaTypes.includes('null')) { ··· 426 464 } 427 465 } 428 466 429 - if (schema.discriminator) { 430 - // TODO: parser - support discriminator 431 - // TODO: parser - maybe abstract discriminator from oneOf, anyOf, and allOf 432 - } 433 - 434 467 return irSchema; 435 468 }; 436 469 437 470 const parseEnum = ({ 438 471 context, 439 472 schema, 440 - }: { 441 - context: IRContext; 473 + }: SchemaContext & { 442 474 schema: SchemaWithRequired<'enum'>; 443 475 }): IRSchemaObject => { 444 476 let irSchema = initIrSchema({ schema }); ··· 501 533 const parseOneOf = ({ 502 534 context, 503 535 schema, 504 - }: { 505 - context: IRContext; 536 + }: SchemaContext & { 506 537 schema: SchemaWithRequired<'oneOf'>; 507 538 }): IRSchemaObject => { 508 539 let irSchema = initIrSchema({ schema }); ··· 510 541 let schemaItems: Array<IRSchemaObject> = []; 511 542 const schemaTypes = getSchemaTypes({ schema }); 512 543 513 - for (const oneOf of schema.oneOf) { 514 - const irOneOfSchema = schemaToIrSchema({ 544 + const compositionSchemas = schema.oneOf; 545 + 546 + for (const compositionSchema of compositionSchemas) { 547 + let irCompositionSchema = schemaToIrSchema({ 515 548 context, 516 - schema: oneOf, 549 + schema: compositionSchema, 517 550 }); 518 551 552 + // `$ref` should be defined with discriminators 553 + if (schema.discriminator && compositionSchema.$ref) { 554 + const irDiscriminatorSchema: IRSchemaObject = { 555 + properties: { 556 + [schema.discriminator.propertyName]: { 557 + const: discriminatorValue( 558 + compositionSchema.$ref, 559 + schema.discriminator.mapping, 560 + ), 561 + type: 'string', 562 + }, 563 + }, 564 + type: 'object', 565 + }; 566 + irCompositionSchema = { 567 + items: [irDiscriminatorSchema, irCompositionSchema], 568 + logicalOperator: 'and', 569 + }; 570 + } 571 + 519 572 // since we know oneOf will be using "or" logical operator, if the parsed 520 573 // composition schema also has an "or" operator, we can bring it up 521 574 // to avoid unnecessary brackets 522 - if (irOneOfSchema.logicalOperator === 'or' && irOneOfSchema.items) { 523 - schemaItems = schemaItems.concat(irOneOfSchema.items); 575 + if ( 576 + irCompositionSchema.logicalOperator === 'or' && 577 + irCompositionSchema.items 578 + ) { 579 + schemaItems = schemaItems.concat(irCompositionSchema.items); 524 580 } else { 525 - schemaItems.push(irOneOfSchema); 581 + schemaItems.push(irCompositionSchema); 526 582 } 527 583 } 528 584 ··· 554 610 } 555 611 } 556 612 557 - if (schema.discriminator) { 558 - // TODO: parser - support discriminator 559 - // TODO: parser - maybe abstract discriminator from oneOf, anyOf, and allOf 560 - } 561 - 562 613 return irSchema; 563 614 }; 564 615 565 616 const parseRef = ({ 566 617 schema, 567 - }: { 568 - context: IRContext; 618 + }: SchemaContext & { 569 619 schema: SchemaWithRequired<'$ref'>; 570 620 }): IRSchemaObject => { 571 621 const irSchema = initIrSchema({ schema }); ··· 581 631 context, 582 632 irSchema, 583 633 schema, 584 - }: { 585 - context: IRContext; 634 + }: SchemaContext & { 586 635 irSchema?: IRSchemaObject; 587 636 schema: Omit<SchemaObject, 'type'> & { 588 637 type: SchemaType; ··· 642 691 context, 643 692 irSchema, 644 693 schema, 645 - }: { 646 - context: IRContext; 694 + }: SchemaContext & { 647 695 irSchema?: IRSchemaObject; 648 696 schema: Omit<SchemaObject, 'type'> & { 649 697 type: ReadonlyArray<SchemaType>; ··· 684 732 const parseType = ({ 685 733 context, 686 734 schema, 687 - }: { 688 - context: IRContext; 735 + }: SchemaContext & { 689 736 schema: SchemaWithRequired<'type'>; 690 737 }): IRSchemaObject => { 691 738 const irSchema = initIrSchema({ schema }); ··· 720 767 721 768 const parseUnknown = ({ 722 769 schema, 723 - }: { 724 - context: IRContext; 770 + }: SchemaContext & { 725 771 schema: SchemaObject; 726 772 }): IRSchemaObject => { 727 773 const irSchema = initIrSchema({ schema }); ··· 737 783 }; 738 784 739 785 export const schemaToIrSchema = ({ 786 + $ref, 740 787 context, 741 788 schema, 742 - }: { 743 - context: IRContext; 789 + }: SchemaContext & { 744 790 schema: SchemaObject; 745 791 }): IRSchemaObject => { 746 792 if (schema.$ref) { 747 793 return parseRef({ 794 + $ref, 748 795 context, 749 796 schema: schema as SchemaWithRequired<'$ref'>, 750 797 }); ··· 752 799 753 800 if (schema.enum) { 754 801 return parseEnum({ 802 + $ref, 755 803 context, 756 804 schema: schema as SchemaWithRequired<'enum'>, 757 805 }); ··· 759 807 760 808 if (schema.allOf) { 761 809 return parseAllOf({ 810 + $ref, 762 811 context, 763 812 schema: schema as SchemaWithRequired<'allOf'>, 764 813 }); ··· 766 815 767 816 if (schema.anyOf) { 768 817 return parseAnyOf({ 818 + $ref, 769 819 context, 770 820 schema: schema as SchemaWithRequired<'anyOf'>, 771 821 }); ··· 773 823 774 824 if (schema.oneOf) { 775 825 return parseOneOf({ 826 + $ref, 776 827 context, 777 828 schema: schema as SchemaWithRequired<'oneOf'>, 778 829 }); ··· 781 832 // infer object based on the presence of properties 782 833 if (schema.type || schema.properties) { 783 834 return parseType({ 835 + $ref, 784 836 context, 785 837 schema: schema as SchemaWithRequired<'type'>, 786 838 }); 787 839 } 788 840 789 841 return parseUnknown({ 842 + $ref, 790 843 context, 791 844 schema, 792 845 }); 793 846 }; 794 847 795 848 export const parseSchema = ({ 849 + $ref, 796 850 context, 797 - name, 798 851 schema, 799 - }: { 800 - context: IRContext; 801 - name: string; 852 + }: Required<SchemaContext> & { 802 853 schema: SchemaObject; 803 854 }) => { 804 855 if (!context.ir.components) { ··· 809 860 context.ir.components.schemas = {}; 810 861 } 811 862 812 - context.ir.components.schemas[name] = schemaToIrSchema({ 863 + context.ir.components.schemas[refToName($ref)] = schemaToIrSchema({ 864 + $ref, 813 865 context, 814 866 schema, 815 867 });
+14
packages/openapi-ts/src/openApi/shared/utils/discriminator.ts
··· 1 + import { refToName } from '../../../utils/ref'; 2 + 3 + export const discriminatorValue = ( 4 + $ref: string, 5 + mapping?: Record<string, string>, 6 + ) => { 7 + for (const name in mapping) { 8 + const refMapped = mapping[name]; 9 + if (refMapped === $ref) { 10 + return name; 11 + } 12 + } 13 + return refToName($ref); 14 + };
+6 -6
packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts
··· 62 62 const schema = structuredClone(_schema); 63 63 64 64 if ('$ref' in schema) { 65 - // refs are encoded probably by json-schema-ref-parser, didn't investigate 66 - // further 67 - schema.$ref = decodeURIComponent(schema.$ref); 65 + // refs using unicode characters become encoded, didn't investigate why 66 + // but the suspicion is this comes from `@apidevtools/json-schema-ref-parser` 67 + schema.$ref = decodeURI(schema.$ref); 68 68 return schema; 69 69 } 70 70 ··· 151 151 stripSchema({ context, schema }); 152 152 153 153 if (schema.$ref) { 154 - // refs are encoded probably by json-schema-ref-parser, didn't investigate 155 - // further 156 - schema.$ref = decodeURIComponent(schema.$ref); 154 + // refs using unicode characters become encoded, didn't investigate why 155 + // but the suspicion is this comes from `@apidevtools/json-schema-ref-parser` 156 + schema.$ref = decodeURI(schema.$ref); 157 157 } 158 158 159 159 if (
+14 -1
packages/openapi-ts/src/utils/ref.ts
··· 6 6 return parts.length === 3 && parts[0] === 'components'; 7 7 }; 8 8 9 + /** 10 + * Returns the component name from `$ref`. 11 + */ 12 + export const refToName = ($ref: string): string => { 13 + const parts = refToParts($ref); 14 + const name = parts[parts.length - 1]; 15 + // refs using unicode characters become encoded, didn't investigate why 16 + // but the suspicion is this comes from `@apidevtools/json-schema-ref-parser` 17 + return decodeURI(name); 18 + }; 19 + 9 20 const refToParts = ($ref: string): string[] => { 10 21 // Remove the leading `#` and split by `/` to traverse the object 11 22 const parts = $ref.replace(/^#\//, '').split('/'); ··· 19 30 $ref: string; 20 31 spec: Record<string, any>; 21 32 }): T => { 22 - const parts = refToParts($ref); 33 + // refs using unicode characters become encoded, didn't investigate why 34 + // but the suspicion is this comes from `@apidevtools/json-schema-ref-parser` 35 + const parts = refToParts(decodeURI($ref)); 23 36 24 37 let current = spec; 25 38
+21
packages/openapi-ts/test/3.0.x.spec.ts
··· 58 58 }, 59 59 { 60 60 config: createConfig({ 61 + input: 'discriminator-all-of.yaml', 62 + output: 'discriminator-all-of', 63 + }), 64 + description: 'handles discriminator with and without mapping', 65 + }, 66 + { 67 + config: createConfig({ 68 + input: 'discriminator-any-of.yaml', 69 + output: 'discriminator-any-of', 70 + }), 71 + description: 'handles discriminator with and without mapping', 72 + }, 73 + { 74 + config: createConfig({ 75 + input: 'discriminator-one-of.yaml', 76 + output: 'discriminator-one-of', 77 + }), 78 + description: 'handles discriminator with and without mapping', 79 + }, 80 + { 81 + config: createConfig({ 61 82 input: 'enum-escape.json', 62 83 output: 'enum-escape', 63 84 }),
+21
packages/openapi-ts/test/3.1.x.spec.ts
··· 58 58 }, 59 59 { 60 60 config: createConfig({ 61 + input: 'discriminator-all-of.yaml', 62 + output: 'discriminator-all-of', 63 + }), 64 + description: 'handles discriminator with and without mapping', 65 + }, 66 + { 67 + config: createConfig({ 68 + input: 'discriminator-any-of.yaml', 69 + output: 'discriminator-any-of', 70 + }), 71 + description: 'handles discriminator with and without mapping', 72 + }, 73 + { 74 + config: createConfig({ 75 + input: 'discriminator-one-of.yaml', 76 + output: 'discriminator-one-of', 77 + }), 78 + description: 'handles discriminator with and without mapping', 79 + }, 80 + { 81 + config: createConfig({ 61 82 input: 'duplicate-null.json', 62 83 output: 'duplicate-null', 63 84 }),
+2
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-all-of/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+45
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-all-of/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = { 4 + id: string; 5 + }; 6 + 7 + export type Bar = Foo & { 8 + id?: 'Bar'; 9 + } & { 10 + bar?: string; 11 + }; 12 + 13 + export type Baz = Foo & { 14 + id?: 'Baz'; 15 + } & { 16 + baz?: string; 17 + }; 18 + 19 + export type Qux = Foo & { 20 + id?: 'Qux'; 21 + } & { 22 + qux?: boolean; 23 + }; 24 + 25 + export type FooMapped = { 26 + id: string; 27 + }; 28 + 29 + export type BarMapped = FooMapped & { 30 + id?: 'bar'; 31 + } & { 32 + bar?: string; 33 + }; 34 + 35 + export type BazMapped = FooMapped & { 36 + id?: 'baz'; 37 + } & { 38 + baz?: string; 39 + }; 40 + 41 + export type QuxMapped = FooMapped & { 42 + id?: 'QuxMapped'; 43 + } & { 44 + qux?: boolean; 45 + };
+2
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-any-of/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+24
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-any-of/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = ({ 4 + type?: 'Bar'; 5 + } & Bar) | ({ 6 + type?: 'Baz'; 7 + } & Baz); 8 + 9 + export type Baz = Qux; 10 + 11 + export type Bar = Qux; 12 + 13 + export type Qux = { 14 + id: string; 15 + type: Quux; 16 + }; 17 + 18 + export type Quux = 'Bar' | 'Baz'; 19 + 20 + export type Quuz = ({ 21 + type?: 'bar'; 22 + } & Bar) | ({ 23 + type?: 'baz'; 24 + } & Baz);
+2
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-one-of/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+24
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-one-of/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = ({ 4 + type?: 'Bar'; 5 + } & Bar) | ({ 6 + type?: 'Baz'; 7 + } & Baz); 8 + 9 + export type Baz = Qux; 10 + 11 + export type Bar = Qux; 12 + 13 + export type Qux = { 14 + id: string; 15 + type: Quux; 16 + }; 17 + 18 + export type Quux = 'Bar' | 'Baz'; 19 + 20 + export type Quuz = ({ 21 + type?: 'bar'; 22 + } & Bar) | ({ 23 + type?: 'baz'; 24 + } & Baz);
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/services/default/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+2
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-all-of/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+45
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-all-of/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = { 4 + id: string; 5 + }; 6 + 7 + export type Bar = Foo & { 8 + id?: 'Bar'; 9 + } & { 10 + bar?: string; 11 + }; 12 + 13 + export type Baz = Foo & { 14 + id?: 'Baz'; 15 + } & { 16 + baz?: string; 17 + }; 18 + 19 + export type Qux = Foo & { 20 + id?: 'Qux'; 21 + } & { 22 + qux?: boolean; 23 + }; 24 + 25 + export type FooMapped = { 26 + id: string; 27 + }; 28 + 29 + export type BarMapped = FooMapped & { 30 + id?: 'bar'; 31 + } & { 32 + bar?: string; 33 + }; 34 + 35 + export type BazMapped = FooMapped & { 36 + id?: 'baz'; 37 + } & { 38 + baz?: string; 39 + }; 40 + 41 + export type QuxMapped = FooMapped & { 42 + id?: 'QuxMapped'; 43 + } & { 44 + qux?: boolean; 45 + };
+2
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-any-of/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+24
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-any-of/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = ({ 4 + type?: 'Bar'; 5 + } & Bar) | ({ 6 + type?: 'Baz'; 7 + } & Baz); 8 + 9 + export type Baz = Qux; 10 + 11 + export type Bar = Qux; 12 + 13 + export type Qux = { 14 + id: string; 15 + type: Quux; 16 + }; 17 + 18 + export type Quux = 'Bar' | 'Baz'; 19 + 20 + export type Quuz = ({ 21 + type?: 'bar'; 22 + } & Bar) | ({ 23 + type?: 'baz'; 24 + } & Baz);
+2
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-one-of/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+24
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-one-of/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = ({ 4 + type?: 'Bar'; 5 + } & Bar) | ({ 6 + type?: 'Baz'; 7 + } & Baz); 8 + 9 + export type Baz = Qux; 10 + 11 + export type Bar = Qux; 12 + 13 + export type Qux = { 14 + id: string; 15 + type: Quux; 16 + }; 17 + 18 + export type Quux = 'Bar' | 'Baz'; 19 + 20 + export type Quuz = ({ 21 + type?: 'bar'; 22 + } & Bar) | ({ 23 + type?: 'baz'; 24 + } & Baz);
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/services/default/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/types.gen.ts
··· 425 425 /** 426 426 * This is a model with one property with a 'one of' relationship where the options are not $ref 427 427 */ 428 - export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; 428 + export type CompositionWithOneOfDiscriminator = ({ 429 + kind?: 'circle'; 430 + } & ModelCircle) | ({ 431 + kind?: 'square'; 432 + } & ModelSquare); 429 433 430 434 /** 431 435 * This is a model with one property with a 'any of' relationship
+2 -1
packages/openapi-ts/test/sample.cjs
··· 13 13 input: { 14 14 // include: 15 15 // '^(#/components/schemas/import|#/paths/api/v{api-version}/simple/options)$', 16 - path: './test/spec/3.1.x/array-items-one-of-length-1.json', 16 + path: './test/spec/3.1.x/discriminator-one-of.yaml', 17 + // path: './test/spec/3.0.x/full.json', 17 18 // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 18 19 }, 19 20 // name: 'foo',
+69
packages/openapi-ts/test/spec/3.0.x/discriminator-all-of.yaml
··· 1 + openapi: 3.0.3 2 + info: 3 + title: OpenAPI 3.0.3 discriminator all of example 4 + version: 1 5 + components: 6 + schemas: 7 + Foo: 8 + type: object 9 + required: 10 + - id 11 + properties: 12 + id: 13 + type: string 14 + discriminator: 15 + propertyName: id 16 + Bar: 17 + allOf: 18 + - $ref: '#/components/schemas/Foo' 19 + - type: object 20 + properties: 21 + bar: 22 + type: string 23 + Baz: 24 + allOf: 25 + - $ref: '#/components/schemas/Foo' 26 + - type: object 27 + properties: 28 + baz: 29 + type: string 30 + Qux: 31 + allOf: 32 + - $ref: '#/components/schemas/Foo' 33 + - type: object 34 + properties: 35 + qux: 36 + type: boolean 37 + FooMapped: 38 + type: object 39 + required: 40 + - id 41 + properties: 42 + id: 43 + type: string 44 + discriminator: 45 + propertyName: id 46 + mapping: 47 + bar: '#/components/schemas/BarMapped' 48 + baz: '#/components/schemas/BazMapped' 49 + BarMapped: 50 + allOf: 51 + - $ref: '#/components/schemas/FooMapped' 52 + - type: object 53 + properties: 54 + bar: 55 + type: string 56 + BazMapped: 57 + allOf: 58 + - $ref: '#/components/schemas/FooMapped' 59 + - type: object 60 + properties: 61 + baz: 62 + type: string 63 + QuxMapped: 64 + allOf: 65 + - $ref: '#/components/schemas/FooMapped' 66 + - type: object 67 + properties: 68 + qux: 69 + type: boolean
+42
packages/openapi-ts/test/spec/3.0.x/discriminator-any-of.yaml
··· 1 + openapi: 3.0.3 2 + info: 3 + title: OpenAPI 3.0.3 discriminator any of example 4 + version: 1 5 + components: 6 + schemas: 7 + Foo: 8 + anyOf: 9 + - $ref: '#/components/schemas/Bar' 10 + - $ref: '#/components/schemas/Baz' 11 + discriminator: 12 + propertyName: type 13 + Baz: 14 + allOf: 15 + - $ref: '#/components/schemas/Qux' 16 + Bar: 17 + allOf: 18 + - $ref: '#/components/schemas/Qux' 19 + Qux: 20 + type: object 21 + properties: 22 + id: 23 + type: string 24 + type: 25 + $ref: '#/components/schemas/Quux' 26 + required: 27 + - id 28 + - type 29 + Quux: 30 + enum: 31 + - Bar 32 + - Baz 33 + type: string 34 + Quuz: 35 + anyOf: 36 + - $ref: '#/components/schemas/Bar' 37 + - $ref: '#/components/schemas/Baz' 38 + discriminator: 39 + propertyName: type 40 + mapping: 41 + bar: '#/components/schemas/Bar' 42 + baz: '#/components/schemas/Baz'
+42
packages/openapi-ts/test/spec/3.0.x/discriminator-one-of.yaml
··· 1 + openapi: 3.0.3 2 + info: 3 + title: OpenAPI 3.0.3 discriminator one of example 4 + version: 1 5 + components: 6 + schemas: 7 + Foo: 8 + oneOf: 9 + - $ref: '#/components/schemas/Bar' 10 + - $ref: '#/components/schemas/Baz' 11 + discriminator: 12 + propertyName: type 13 + Baz: 14 + allOf: 15 + - $ref: '#/components/schemas/Qux' 16 + Bar: 17 + allOf: 18 + - $ref: '#/components/schemas/Qux' 19 + Qux: 20 + type: object 21 + properties: 22 + id: 23 + type: string 24 + type: 25 + $ref: '#/components/schemas/Quux' 26 + required: 27 + - id 28 + - type 29 + Quux: 30 + enum: 31 + - Bar 32 + - Baz 33 + type: string 34 + Quuz: 35 + oneOf: 36 + - $ref: '#/components/schemas/Bar' 37 + - $ref: '#/components/schemas/Baz' 38 + discriminator: 39 + propertyName: type 40 + mapping: 41 + bar: '#/components/schemas/Bar' 42 + baz: '#/components/schemas/Baz'
+23
packages/openapi-ts/test/spec/3.0.x/ref-duplicate-url.yaml
··· 1 + openapi: 3.0.3 2 + info: 3 + title: OpenAPI 3.0.3 $ref duplicate URL example 4 + version: 1 5 + paths: 6 + /a: 7 + get: 8 + responses: 9 + default: 10 + description: OK 11 + content: 12 + application/json: 13 + schema: 14 + $ref: './enum-escape.json#/components/schemas/Foo' 15 + /b: 16 + get: 17 + responses: 18 + default: 19 + description: OK 20 + content: 21 + application/json: 22 + schema: 23 + $ref: './enum-escape.json#/components/schemas/Foo'
+69
packages/openapi-ts/test/spec/3.1.x/discriminator-all-of.yaml
··· 1 + openapi: 3.1.0 2 + info: 3 + title: OpenAPI 3.1.0 discriminator all of example 4 + version: 1 5 + components: 6 + schemas: 7 + Foo: 8 + type: object 9 + required: 10 + - id 11 + properties: 12 + id: 13 + type: string 14 + discriminator: 15 + propertyName: id 16 + Bar: 17 + allOf: 18 + - $ref: '#/components/schemas/Foo' 19 + - type: object 20 + properties: 21 + bar: 22 + type: string 23 + Baz: 24 + allOf: 25 + - $ref: '#/components/schemas/Foo' 26 + - type: object 27 + properties: 28 + baz: 29 + type: string 30 + Qux: 31 + allOf: 32 + - $ref: '#/components/schemas/Foo' 33 + - type: object 34 + properties: 35 + qux: 36 + type: boolean 37 + FooMapped: 38 + type: object 39 + required: 40 + - id 41 + properties: 42 + id: 43 + type: string 44 + discriminator: 45 + propertyName: id 46 + mapping: 47 + bar: '#/components/schemas/BarMapped' 48 + baz: '#/components/schemas/BazMapped' 49 + BarMapped: 50 + allOf: 51 + - $ref: '#/components/schemas/FooMapped' 52 + - type: object 53 + properties: 54 + bar: 55 + type: string 56 + BazMapped: 57 + allOf: 58 + - $ref: '#/components/schemas/FooMapped' 59 + - type: object 60 + properties: 61 + baz: 62 + type: string 63 + QuxMapped: 64 + allOf: 65 + - $ref: '#/components/schemas/FooMapped' 66 + - type: object 67 + properties: 68 + qux: 69 + type: boolean
+42
packages/openapi-ts/test/spec/3.1.x/discriminator-any-of.yaml
··· 1 + openapi: 3.1.0 2 + info: 3 + title: OpenAPI 3.1.0 discriminator any of example 4 + version: 1 5 + components: 6 + schemas: 7 + Foo: 8 + anyOf: 9 + - $ref: '#/components/schemas/Bar' 10 + - $ref: '#/components/schemas/Baz' 11 + discriminator: 12 + propertyName: type 13 + Baz: 14 + allOf: 15 + - $ref: '#/components/schemas/Qux' 16 + Bar: 17 + allOf: 18 + - $ref: '#/components/schemas/Qux' 19 + Qux: 20 + type: object 21 + properties: 22 + id: 23 + type: string 24 + type: 25 + $ref: '#/components/schemas/Quux' 26 + required: 27 + - id 28 + - type 29 + Quux: 30 + enum: 31 + - Bar 32 + - Baz 33 + type: string 34 + Quuz: 35 + anyOf: 36 + - $ref: '#/components/schemas/Bar' 37 + - $ref: '#/components/schemas/Baz' 38 + discriminator: 39 + propertyName: type 40 + mapping: 41 + bar: '#/components/schemas/Bar' 42 + baz: '#/components/schemas/Baz'
+42
packages/openapi-ts/test/spec/3.1.x/discriminator-one-of.yaml
··· 1 + openapi: 3.1.0 2 + info: 3 + title: OpenAPI 3.1.0 discriminator one of example 4 + version: 1 5 + components: 6 + schemas: 7 + Foo: 8 + oneOf: 9 + - $ref: '#/components/schemas/Bar' 10 + - $ref: '#/components/schemas/Baz' 11 + discriminator: 12 + propertyName: type 13 + Baz: 14 + allOf: 15 + - $ref: '#/components/schemas/Qux' 16 + Bar: 17 + allOf: 18 + - $ref: '#/components/schemas/Qux' 19 + Qux: 20 + type: object 21 + properties: 22 + id: 23 + type: string 24 + type: 25 + $ref: '#/components/schemas/Quux' 26 + required: 27 + - id 28 + - type 29 + Quux: 30 + enum: 31 + - Bar 32 + - Baz 33 + type: string 34 + Quuz: 35 + oneOf: 36 + - $ref: '#/components/schemas/Bar' 37 + - $ref: '#/components/schemas/Baz' 38 + discriminator: 39 + propertyName: type 40 + mapping: 41 + bar: '#/components/schemas/Bar' 42 + baz: '#/components/schemas/Baz'
+72 -180
pnpm-lock.yaml
··· 266 266 devDependencies: 267 267 '@angular-devkit/build-angular': 268 268 specifier: ^18.2.11 269 - version: 18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(karma@6.4.4)(tailwindcss@3.4.9)(typescript@5.5.3) 269 + version: 18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(karma@6.4.4)(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)))(typescript@5.5.3) 270 270 '@angular/cli': 271 271 specifier: ^18.2.11 272 272 version: 18.2.11(chokidar@3.6.0) ··· 5120 5120 engines: {node: '>=18'} 5121 5121 hasBin: true 5122 5122 5123 - escalade@3.1.2: 5124 - resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} 5125 - engines: {node: '>=6'} 5126 - 5127 5123 escalade@3.2.0: 5128 5124 resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} 5129 5125 engines: {node: '>=6'} ··· 8893 8889 dependencies: 8894 8890 '@ampproject/remapping': 2.3.0 8895 8891 '@angular-devkit/architect': 0.1802.11(chokidar@3.6.0) 8896 - '@angular-devkit/build-webpack': 0.1802.11(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)))(webpack@5.94.0(esbuild@0.23.0)) 8892 + '@angular-devkit/build-webpack': 0.1802.11(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0))(webpack@5.94.0(esbuild@0.23.0)) 8897 8893 '@angular-devkit/core': 18.2.11(chokidar@3.6.0) 8898 8894 '@angular/build': 18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(less@4.2.0)(postcss@8.4.41)(tailwindcss@3.4.9(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)))(terser@5.31.6)(typescript@5.5.3) 8899 8895 '@angular/compiler-cli': 18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3) ··· 8950 8946 typescript: 5.5.3 8951 8947 vite: 5.4.6(@types/node@22.8.5)(less@4.2.0)(sass@1.77.6)(terser@5.31.6) 8952 8948 watchpack: 2.4.1 8953 - webpack: 5.94.0(esbuild@0.23.1) 8954 - webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.0)) 8955 - webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.0)) 8949 + webpack: 5.94.0(esbuild@0.23.0) 8950 + webpack-dev-middleware: 7.4.2(webpack@5.94.0) 8951 + webpack-dev-server: 5.0.4(webpack@5.94.0) 8956 8952 webpack-merge: 6.0.1 8957 8953 webpack-subresource-integrity: 5.1.0(webpack@5.94.0(esbuild@0.23.0)) 8958 8954 optionalDependencies: ··· 8977 8973 - utf-8-validate 8978 8974 - webpack-cli 8979 8975 8980 - '@angular-devkit/build-angular@18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(karma@6.4.4)(tailwindcss@3.4.9)(typescript@5.5.3)': 8981 - dependencies: 8982 - '@ampproject/remapping': 2.3.0 8983 - '@angular-devkit/architect': 0.1802.11(chokidar@3.6.0) 8984 - '@angular-devkit/build-webpack': 0.1802.11(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)))(webpack@5.94.0(esbuild@0.23.0)) 8985 - '@angular-devkit/core': 18.2.11(chokidar@3.6.0) 8986 - '@angular/build': 18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(less@4.2.0)(postcss@8.4.41)(tailwindcss@3.4.9)(terser@5.31.6)(typescript@5.5.3) 8987 - '@angular/compiler-cli': 18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3) 8988 - '@babel/core': 7.25.2 8989 - '@babel/generator': 7.25.0 8990 - '@babel/helper-annotate-as-pure': 7.24.7 8991 - '@babel/helper-split-export-declaration': 7.24.7 8992 - '@babel/plugin-transform-async-generator-functions': 7.25.0(@babel/core@7.25.2) 8993 - '@babel/plugin-transform-async-to-generator': 7.24.7(@babel/core@7.25.2) 8994 - '@babel/plugin-transform-runtime': 7.24.7(@babel/core@7.25.2) 8995 - '@babel/preset-env': 7.25.3(@babel/core@7.25.2) 8996 - '@babel/runtime': 7.25.0 8997 - '@discoveryjs/json-ext': 0.6.1 8998 - '@ngtools/webpack': 18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(typescript@5.5.3)(webpack@5.94.0(esbuild@0.23.0)) 8999 - '@vitejs/plugin-basic-ssl': 1.1.0(vite@5.4.6(@types/node@22.8.5)(less@4.2.0)(sass@1.77.6)(terser@5.31.6)) 9000 - ansi-colors: 4.1.3 9001 - autoprefixer: 10.4.20(postcss@8.4.41) 9002 - babel-loader: 9.1.3(@babel/core@7.25.2)(webpack@5.94.0(esbuild@0.23.0)) 9003 - browserslist: 4.24.2 9004 - copy-webpack-plugin: 12.0.2(webpack@5.94.0(esbuild@0.23.0)) 9005 - critters: 0.0.24 9006 - css-loader: 7.1.2(webpack@5.94.0(esbuild@0.23.0)) 9007 - esbuild-wasm: 0.23.0 9008 - fast-glob: 3.3.2 9009 - http-proxy-middleware: 3.0.3 9010 - https-proxy-agent: 7.0.5 9011 - istanbul-lib-instrument: 6.0.3 9012 - jsonc-parser: 3.3.1 9013 - karma-source-map-support: 1.4.0 9014 - less: 4.2.0 9015 - less-loader: 12.2.0(less@4.2.0)(webpack@5.94.0(esbuild@0.23.0)) 9016 - license-webpack-plugin: 4.0.2(webpack@5.94.0(esbuild@0.23.0)) 9017 - loader-utils: 3.3.1 9018 - magic-string: 0.30.11 9019 - mini-css-extract-plugin: 2.9.0(webpack@5.94.0(esbuild@0.23.0)) 9020 - mrmime: 2.0.0 9021 - open: 10.1.0 9022 - ora: 5.4.1 9023 - parse5-html-rewriting-stream: 7.0.0 9024 - picomatch: 4.0.2 9025 - piscina: 4.6.1 9026 - postcss: 8.4.41 9027 - postcss-loader: 8.1.1(postcss@8.4.41)(typescript@5.5.3)(webpack@5.94.0(esbuild@0.23.0)) 9028 - resolve-url-loader: 5.0.0 9029 - rxjs: 7.8.1 9030 - sass: 1.77.6 9031 - sass-loader: 16.0.0(sass@1.77.6)(webpack@5.94.0(esbuild@0.23.0)) 9032 - semver: 7.6.3 9033 - source-map-loader: 5.0.0(webpack@5.94.0(esbuild@0.23.0)) 9034 - source-map-support: 0.5.21 9035 - terser: 5.31.6 9036 - tree-kill: 1.2.2 9037 - tslib: 2.6.3 9038 - typescript: 5.5.3 9039 - vite: 5.4.6(@types/node@22.8.5)(less@4.2.0)(sass@1.77.6)(terser@5.31.6) 9040 - watchpack: 2.4.1 9041 - webpack: 5.94.0(esbuild@0.23.1) 9042 - webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.0)) 9043 - webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.0)) 9044 - webpack-merge: 6.0.1 9045 - webpack-subresource-integrity: 5.1.0(webpack@5.94.0(esbuild@0.23.0)) 9046 - optionalDependencies: 9047 - esbuild: 0.23.0 9048 - karma: 6.4.4 9049 - tailwindcss: 3.4.9(ts-node@10.9.2(@types/node@20.14.5)(typescript@5.5.3)) 9050 - transitivePeerDependencies: 9051 - - '@rspack/core' 9052 - - '@swc/core' 9053 - - '@types/node' 9054 - - bufferutil 9055 - - chokidar 9056 - - debug 9057 - - html-webpack-plugin 9058 - - lightningcss 9059 - - node-sass 9060 - - sass-embedded 9061 - - stylus 9062 - - sugarss 9063 - - supports-color 9064 - - uglify-js 9065 - - utf-8-validate 9066 - - webpack-cli 9067 - 9068 - '@angular-devkit/build-webpack@0.1802.11(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)))(webpack@5.94.0(esbuild@0.23.0))': 8976 + '@angular-devkit/build-webpack@0.1802.11(chokidar@3.6.0)(webpack-dev-server@5.0.4(webpack@5.94.0))(webpack@5.94.0(esbuild@0.23.0))': 9069 8977 dependencies: 9070 8978 '@angular-devkit/architect': 0.1802.11(chokidar@3.6.0) 9071 8979 rxjs: 7.8.1 9072 - webpack: 5.94.0(esbuild@0.23.1) 9073 - webpack-dev-server: 5.0.4(webpack@5.94.0(esbuild@0.23.0)) 8980 + webpack: 5.94.0(esbuild@0.23.0) 8981 + webpack-dev-server: 5.0.4(webpack@5.94.0) 9074 8982 transitivePeerDependencies: 9075 8983 - chokidar 9076 8984 ··· 9143 9051 - supports-color 9144 9052 - terser 9145 9053 9146 - '@angular/build@18.2.11(@angular/compiler-cli@18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3))(@types/node@22.8.5)(chokidar@3.6.0)(less@4.2.0)(postcss@8.4.41)(tailwindcss@3.4.9)(terser@5.31.6)(typescript@5.5.3)': 9147 - dependencies: 9148 - '@ampproject/remapping': 2.3.0 9149 - '@angular-devkit/architect': 0.1802.11(chokidar@3.6.0) 9150 - '@angular/compiler-cli': 18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3) 9151 - '@babel/core': 7.25.2 9152 - '@babel/helper-annotate-as-pure': 7.24.7 9153 - '@babel/helper-split-export-declaration': 7.24.7 9154 - '@babel/plugin-syntax-import-attributes': 7.24.7(@babel/core@7.25.2) 9155 - '@inquirer/confirm': 3.1.22 9156 - '@vitejs/plugin-basic-ssl': 1.1.0(vite@5.4.6(@types/node@22.8.5)(less@4.2.0)(sass@1.77.6)(terser@5.31.6)) 9157 - browserslist: 4.24.2 9158 - critters: 0.0.24 9159 - esbuild: 0.23.0 9160 - fast-glob: 3.3.2 9161 - https-proxy-agent: 7.0.5 9162 - listr2: 8.2.4 9163 - lmdb: 3.0.13 9164 - magic-string: 0.30.11 9165 - mrmime: 2.0.0 9166 - parse5-html-rewriting-stream: 7.0.0 9167 - picomatch: 4.0.2 9168 - piscina: 4.6.1 9169 - rollup: 4.22.4 9170 - sass: 1.77.6 9171 - semver: 7.6.3 9172 - typescript: 5.5.3 9173 - vite: 5.4.6(@types/node@22.8.5)(less@4.2.0)(sass@1.77.6)(terser@5.31.6) 9174 - watchpack: 2.4.1 9175 - optionalDependencies: 9176 - less: 4.2.0 9177 - postcss: 8.4.41 9178 - tailwindcss: 3.4.9(ts-node@10.9.2(@types/node@20.14.5)(typescript@5.5.3)) 9179 - transitivePeerDependencies: 9180 - - '@types/node' 9181 - - chokidar 9182 - - lightningcss 9183 - - sass-embedded 9184 - - stylus 9185 - - sugarss 9186 - - supports-color 9187 - - terser 9188 - 9189 9054 '@angular/cdk@18.2.11(@angular/common@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0))(rxjs@7.8.1))(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0))(rxjs@7.8.1)': 9190 9055 dependencies: 9191 9056 '@angular/common': 18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0))(rxjs@7.8.1) ··· 11088 10953 dependencies: 11089 10954 '@angular/compiler-cli': 18.2.10(@angular/compiler@18.2.10(@angular/core@18.2.10(rxjs@7.8.1)(zone.js@0.15.0)))(typescript@5.5.3) 11090 10955 typescript: 5.5.3 11091 - webpack: 5.94.0(esbuild@0.23.1) 10956 + webpack: 5.94.0(esbuild@0.23.0) 11092 10957 11093 10958 '@nodelib/fs.scandir@2.1.5': 11094 10959 dependencies: ··· 12203 12068 12204 12069 '@types/cors@2.8.17': 12205 12070 dependencies: 12206 - '@types/node': 20.14.10 12071 + '@types/node': 22.8.5 12207 12072 12208 12073 '@types/cross-spawn@6.0.6': 12209 12074 dependencies: ··· 12770 12635 12771 12636 '@vue/compiler-sfc@3.5.12': 12772 12637 dependencies: 12773 - '@babel/parser': 7.25.3 12638 + '@babel/parser': 7.26.2 12774 12639 '@vue/compiler-core': 3.5.12 12775 12640 '@vue/compiler-dom': 3.5.12 12776 12641 '@vue/compiler-ssr': 3.5.12 ··· 13267 13132 '@babel/core': 7.25.2 13268 13133 find-cache-dir: 4.0.0 13269 13134 schema-utils: 4.2.0 13270 - webpack: 5.94.0(esbuild@0.23.1) 13135 + webpack: 5.94.0(esbuild@0.23.0) 13271 13136 13272 13137 babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.25.2): 13273 13138 dependencies: ··· 13720 13585 normalize-path: 3.0.0 13721 13586 schema-utils: 4.2.0 13722 13587 serialize-javascript: 6.0.2 13723 - webpack: 5.94.0(esbuild@0.23.1) 13588 + webpack: 5.94.0(esbuild@0.23.0) 13724 13589 13725 13590 core-js-compat@3.39.0: 13726 13591 dependencies: ··· 13777 13642 postcss-value-parser: 4.2.0 13778 13643 semver: 7.6.3 13779 13644 optionalDependencies: 13780 - webpack: 5.94.0(esbuild@0.23.1) 13645 + webpack: 5.94.0(esbuild@0.23.0) 13781 13646 13782 13647 css-select@5.1.0: 13783 13648 dependencies: ··· 13995 13860 dependencies: 13996 13861 '@types/cookie': 0.4.1 13997 13862 '@types/cors': 2.8.17 13998 - '@types/node': 20.14.10 13863 + '@types/node': 22.8.5 13999 13864 accepts: 1.3.8 14000 13865 base64id: 2.0.0 14001 13866 cookie: 0.7.2 ··· 14132 13997 '@esbuild/win32-arm64': 0.23.1 14133 13998 '@esbuild/win32-ia32': 0.23.1 14134 13999 '@esbuild/win32-x64': 0.23.1 14135 - 14136 - escalade@3.1.2: {} 14137 14000 14138 14001 escalade@3.2.0: {} 14139 14002 ··· 15307 15170 dependencies: 15308 15171 less: 4.2.0 15309 15172 optionalDependencies: 15310 - webpack: 5.94.0(esbuild@0.23.1) 15173 + webpack: 5.94.0(esbuild@0.23.0) 15311 15174 15312 15175 less@4.2.0: 15313 15176 dependencies: ··· 15332 15195 dependencies: 15333 15196 webpack-sources: 3.2.3 15334 15197 optionalDependencies: 15335 - webpack: 5.94.0(esbuild@0.23.1) 15198 + webpack: 5.94.0(esbuild@0.23.0) 15336 15199 15337 15200 lilconfig@2.1.0: {} 15338 15201 ··· 15453 15316 log4js@6.9.1: 15454 15317 dependencies: 15455 15318 date-format: 4.0.14 15456 - debug: 4.3.5 15319 + debug: 4.3.7 15457 15320 flatted: 3.3.1 15458 15321 rfdc: 1.4.1 15459 15322 streamroller: 3.1.5 ··· 15601 15464 dependencies: 15602 15465 schema-utils: 4.2.0 15603 15466 tapable: 2.2.1 15604 - webpack: 5.94.0(esbuild@0.23.1) 15467 + webpack: 5.94.0(esbuild@0.23.0) 15605 15468 15606 15469 minimalistic-assert@1.0.1: {} 15607 15470 ··· 16171 16034 read-cache: 1.0.0 16172 16035 resolve: 1.22.8 16173 16036 16037 + postcss-import@15.1.0(postcss@8.4.47): 16038 + dependencies: 16039 + postcss: 8.4.47 16040 + postcss-value-parser: 4.2.0 16041 + read-cache: 1.0.0 16042 + resolve: 1.22.8 16043 + optional: true 16044 + 16174 16045 postcss-js@4.0.1(postcss@8.4.41): 16175 16046 dependencies: 16176 16047 camelcase-css: 2.0.1 16177 16048 postcss: 8.4.41 16049 + 16050 + postcss-js@4.0.1(postcss@8.4.47): 16051 + dependencies: 16052 + camelcase-css: 2.0.1 16053 + postcss: 8.4.47 16054 + optional: true 16178 16055 16179 16056 postcss-load-config@3.1.4(postcss@8.4.41)(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)): 16180 16057 dependencies: ··· 16200 16077 postcss: 8.4.41 16201 16078 ts-node: 10.9.2(@types/node@22.8.5)(typescript@5.5.3) 16202 16079 16080 + postcss-load-config@4.0.2(postcss@8.4.47)(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)): 16081 + dependencies: 16082 + lilconfig: 3.1.2 16083 + yaml: 2.4.5 16084 + optionalDependencies: 16085 + postcss: 8.4.47 16086 + ts-node: 10.9.2(@types/node@22.8.5)(typescript@5.5.3) 16087 + optional: true 16088 + 16203 16089 postcss-load-config@6.0.1(jiti@2.3.1)(postcss@8.4.47)(tsx@4.19.1)(yaml@2.4.5): 16204 16090 dependencies: 16205 16091 lilconfig: 3.1.2 ··· 16216 16102 postcss: 8.4.41 16217 16103 semver: 7.6.3 16218 16104 optionalDependencies: 16219 - webpack: 5.94.0(esbuild@0.23.1) 16105 + webpack: 5.94.0(esbuild@0.23.0) 16220 16106 transitivePeerDependencies: 16221 16107 - typescript 16222 16108 ··· 16248 16134 postcss: 8.4.41 16249 16135 postcss-selector-parser: 6.1.0 16250 16136 16137 + postcss-nested@6.0.1(postcss@8.4.47): 16138 + dependencies: 16139 + postcss: 8.4.47 16140 + postcss-selector-parser: 6.1.0 16141 + optional: true 16142 + 16251 16143 postcss-safe-parser@6.0.0(postcss@8.4.41): 16252 16144 dependencies: 16253 16145 postcss: 8.4.41 ··· 16670 16562 neo-async: 2.6.2 16671 16563 optionalDependencies: 16672 16564 sass: 1.77.6 16673 - webpack: 5.94.0(esbuild@0.23.1) 16565 + webpack: 5.94.0(esbuild@0.23.0) 16674 16566 16675 16567 sass@1.77.6: 16676 16568 dependencies: ··· 16887 16779 accepts: 1.3.8 16888 16780 base64id: 2.0.0 16889 16781 cors: 2.8.5 16890 - debug: 4.3.5 16782 + debug: 4.3.7 16891 16783 engine.io: 6.6.2 16892 16784 socket.io-adapter: 2.5.5 16893 16785 socket.io-parser: 4.2.4 ··· 16936 16828 dependencies: 16937 16829 iconv-lite: 0.6.3 16938 16830 source-map-js: 1.2.1 16939 - webpack: 5.94.0(esbuild@0.23.1) 16831 + webpack: 5.94.0(esbuild@0.23.0) 16940 16832 16941 16833 source-map-support@0.5.21: 16942 16834 dependencies: ··· 17168 17060 '@jridgewell/sourcemap-codec': 1.5.0 17169 17061 '@jridgewell/trace-mapping': 0.3.25 17170 17062 '@types/estree': 1.0.5 17171 - acorn: 8.12.1 17063 + acorn: 8.14.0 17172 17064 aria-query: 5.3.0 17173 17065 axobject-query: 4.1.0 17174 17066 code-red: 1.0.4 ··· 17258 17150 is-glob: 4.0.3 17259 17151 jiti: 1.21.6 17260 17152 lilconfig: 2.1.0 17261 - micromatch: 4.0.7 17153 + micromatch: 4.0.8 17262 17154 normalize-path: 3.0.0 17263 17155 object-hash: 3.0.0 17264 - picocolors: 1.0.1 17265 - postcss: 8.4.41 17266 - postcss-import: 15.1.0(postcss@8.4.41) 17267 - postcss-js: 4.0.1(postcss@8.4.41) 17268 - postcss-load-config: 4.0.2(postcss@8.4.41)(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)) 17269 - postcss-nested: 6.0.1(postcss@8.4.41) 17156 + picocolors: 1.1.0 17157 + postcss: 8.4.47 17158 + postcss-import: 15.1.0(postcss@8.4.47) 17159 + postcss-js: 4.0.1(postcss@8.4.47) 17160 + postcss-load-config: 4.0.2(postcss@8.4.47)(ts-node@10.9.2(@types/node@22.8.5)(typescript@5.5.3)) 17161 + postcss-nested: 6.0.1(postcss@8.4.47) 17270 17162 postcss-selector-parser: 6.1.0 17271 17163 resolve: 1.22.8 17272 17164 sucrase: 3.35.0 ··· 17301 17193 17302 17194 term-size@2.2.1: {} 17303 17195 17304 - terser-webpack-plugin@5.3.10(esbuild@0.23.1)(webpack@5.94.0(esbuild@0.23.0)): 17196 + terser-webpack-plugin@5.3.10(esbuild@0.23.0)(webpack@5.94.0): 17305 17197 dependencies: 17306 17198 '@jridgewell/trace-mapping': 0.3.25 17307 17199 jest-worker: 27.5.1 17308 17200 schema-utils: 3.3.0 17309 17201 serialize-javascript: 6.0.2 17310 17202 terser: 5.31.6 17311 - webpack: 5.94.0(esbuild@0.23.1) 17203 + webpack: 5.94.0(esbuild@0.23.0) 17312 17204 optionalDependencies: 17313 - esbuild: 0.23.1 17205 + esbuild: 0.23.0 17314 17206 17315 17207 terser@5.31.6: 17316 17208 dependencies: ··· 18040 17932 18041 17933 webidl-conversions@7.0.0: {} 18042 17934 18043 - webpack-dev-middleware@7.4.2(webpack@5.94.0(esbuild@0.23.0)): 17935 + webpack-dev-middleware@7.4.2(webpack@5.94.0): 18044 17936 dependencies: 18045 17937 colorette: 2.0.20 18046 17938 memfs: 4.14.0 ··· 18049 17941 range-parser: 1.2.1 18050 17942 schema-utils: 4.2.0 18051 17943 optionalDependencies: 18052 - webpack: 5.94.0(esbuild@0.23.1) 17944 + webpack: 5.94.0(esbuild@0.23.0) 18053 17945 18054 - webpack-dev-server@5.0.4(webpack@5.94.0(esbuild@0.23.0)): 17946 + webpack-dev-server@5.0.4(webpack@5.94.0): 18055 17947 dependencies: 18056 17948 '@types/bonjour': 3.5.13 18057 17949 '@types/connect-history-api-fallback': 1.5.4 ··· 18081 17973 serve-index: 1.9.1 18082 17974 sockjs: 0.3.24 18083 17975 spdy: 4.0.2 18084 - webpack-dev-middleware: 7.4.2(webpack@5.94.0(esbuild@0.23.0)) 17976 + webpack-dev-middleware: 7.4.2(webpack@5.94.0) 18085 17977 ws: 8.17.1 18086 17978 optionalDependencies: 18087 - webpack: 5.94.0(esbuild@0.23.1) 17979 + webpack: 5.94.0(esbuild@0.23.0) 18088 17980 transitivePeerDependencies: 18089 17981 - bufferutil 18090 17982 - debug ··· 18102 17994 webpack-subresource-integrity@5.1.0(webpack@5.94.0(esbuild@0.23.0)): 18103 17995 dependencies: 18104 17996 typed-assert: 1.0.9 18105 - webpack: 5.94.0(esbuild@0.23.1) 17997 + webpack: 5.94.0(esbuild@0.23.0) 18106 17998 18107 - webpack@5.94.0(esbuild@0.23.1): 17999 + webpack@5.94.0(esbuild@0.23.0): 18108 18000 dependencies: 18109 18001 '@types/estree': 1.0.5 18110 18002 '@webassemblyjs/ast': 1.12.1 ··· 18126 18018 neo-async: 2.6.2 18127 18019 schema-utils: 3.3.0 18128 18020 tapable: 2.2.1 18129 - terser-webpack-plugin: 5.3.10(esbuild@0.23.1)(webpack@5.94.0(esbuild@0.23.0)) 18021 + terser-webpack-plugin: 5.3.10(esbuild@0.23.0)(webpack@5.94.0) 18130 18022 watchpack: 2.4.1 18131 18023 webpack-sources: 3.2.3 18132 18024 transitivePeerDependencies: ··· 18245 18137 yargs@16.2.0: 18246 18138 dependencies: 18247 18139 cliui: 7.0.4 18248 - escalade: 3.1.2 18140 + escalade: 3.2.0 18249 18141 get-caller-file: 2.0.5 18250 18142 require-directory: 2.1.1 18251 18143 string-width: 4.2.3