@aws/nx-plugin 0.38.2 → 0.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "0.38.2",
3
+ "version": "0.38.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -1079,7 +1079,6 @@ exports[`openApiTsClientGenerator - arrays > should handle operation which retur
1079
1079
  Order,
1080
1080
  OrderItemsItem,
1081
1081
  OrderShippingAddress,
1082
- OrderStatus,
1083
1082
  GetOrdersRequest,
1084
1083
  } from './types.gen.js';
1085
1084
 
@@ -40,8 +40,6 @@ exports[`openApiTsClientGenerator - composite schemas > should generate valid Ty
40
40
  PutTestRequestContent,
41
41
  PutTestRequestContentOneOf,
42
42
  PutTestRequestContentOneOf1,
43
- PutTestRequestContentOneOf1Type,
44
- PutTestRequestContentOneOfType,
45
43
  PutTestRequest,
46
44
  } from './types.gen.js';
47
45
 
@@ -356,6 +354,457 @@ export class TestApi {
356
354
  "
357
355
  `;
358
356
 
357
+ exports[`openApiTsClientGenerator - composite schemas > should handle anyOf with any type 1`] = `
358
+ "export type TestAnyOfAny200Response = {
359
+ result?: string;
360
+ };
361
+ export type TestAnyOfAnyRequestContent = {
362
+ anyType?: TestAnyOfAnyRequestContentAnyType;
363
+ };
364
+ export type TestAnyOfAnyRequestContentAnyType = unknown | null;
365
+
366
+ export type TestAnyOfAnyRequest = TestAnyOfAnyRequestContent | undefined;
367
+ export type TestAnyOfAnyError = never;
368
+ "
369
+ `;
370
+
371
+ exports[`openApiTsClientGenerator - composite schemas > should handle anyOf with any type 2`] = `
372
+ "import type {
373
+ TestAnyOfAny200Response,
374
+ TestAnyOfAnyRequestContent,
375
+ TestAnyOfAnyRequestContentAnyType,
376
+ TestAnyOfAnyRequest,
377
+ } from './types.gen.js';
378
+
379
+ /**
380
+ * Utility for serialisation and deserialisation of API types.
381
+ */
382
+ export class $IO {
383
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
384
+ Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
385
+
386
+ public static TestAnyOfAny200Response = {
387
+ toJson: (model: TestAnyOfAny200Response): any => {
388
+ if (model === undefined || model === null) {
389
+ return model;
390
+ }
391
+ return {
392
+ ...(model.result === undefined
393
+ ? {}
394
+ : {
395
+ result: model.result,
396
+ }),
397
+ };
398
+ },
399
+ fromJson: (json: any): TestAnyOfAny200Response => {
400
+ if (json === undefined || json === null) {
401
+ return json;
402
+ }
403
+ return {
404
+ ...(json['result'] === undefined
405
+ ? {}
406
+ : {
407
+ result: json['result'],
408
+ }),
409
+ };
410
+ },
411
+ };
412
+
413
+ public static TestAnyOfAnyRequestContent = {
414
+ toJson: (model: TestAnyOfAnyRequestContent): any => {
415
+ if (model === undefined || model === null) {
416
+ return model;
417
+ }
418
+ return {
419
+ ...(model.anyType === undefined
420
+ ? {}
421
+ : {
422
+ anyType: $IO.TestAnyOfAnyRequestContentAnyType.toJson(
423
+ model.anyType,
424
+ ),
425
+ }),
426
+ };
427
+ },
428
+ fromJson: (json: any): TestAnyOfAnyRequestContent => {
429
+ if (json === undefined || json === null) {
430
+ return json;
431
+ }
432
+ return {
433
+ ...(json['anyType'] === undefined
434
+ ? {}
435
+ : {
436
+ anyType: $IO.TestAnyOfAnyRequestContentAnyType.fromJson(
437
+ json['anyType'],
438
+ ),
439
+ }),
440
+ };
441
+ },
442
+ };
443
+
444
+ public static TestAnyOfAnyRequestContentAnyType = {
445
+ toJson: (model: TestAnyOfAnyRequestContentAnyType): any => {
446
+ if (model === undefined || model === null) {
447
+ return model;
448
+ }
449
+ return model;
450
+ },
451
+ fromJson: (json: any): TestAnyOfAnyRequestContentAnyType => {
452
+ if (json === undefined || json === null) {
453
+ return json;
454
+ }
455
+ return json;
456
+ },
457
+ };
458
+ }
459
+
460
+ /**
461
+ * Client configuration for TestApi
462
+ */
463
+ export interface TestApiConfig {
464
+ /**
465
+ * Base URL for the API
466
+ */
467
+ url: string;
468
+ /**
469
+ * Custom instance of fetch. By default the global 'fetch' is used.
470
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
471
+ */
472
+ fetch?: typeof fetch;
473
+ /**
474
+ * Additional configuration
475
+ */
476
+ options?: {
477
+ /**
478
+ * By default, the client will add a Content-Type header, set to the media type defined for
479
+ * the request in the OpenAPI specification.
480
+ * Set this to false to omit this header.
481
+ */
482
+ omitContentTypeHeader?: boolean;
483
+ };
484
+ }
485
+
486
+ /**
487
+ * API Client for TestApi
488
+ */
489
+ export class TestApi {
490
+ private $config: TestApiConfig;
491
+
492
+ constructor(config: TestApiConfig) {
493
+ this.$config = config;
494
+
495
+ this.testAnyOfAny = this.testAnyOfAny.bind(this);
496
+ }
497
+
498
+ private $url = (
499
+ path: string,
500
+ pathParameters: { [key: string]: any },
501
+ queryParameters: { [key: string]: any },
502
+ collectionFormats?: { [key: string]: 'multi' | 'csv' },
503
+ ): string => {
504
+ const baseUrl = this.$config.url.endsWith('/')
505
+ ? this.$config.url.slice(0, -1)
506
+ : this.$config.url;
507
+ const pathWithParameters = Object.entries(pathParameters).reduce(
508
+ (withParams, [key, value]) =>
509
+ withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
510
+ path,
511
+ );
512
+ const queryString = Object.entries(queryParameters)
513
+ .map(([key, value]) => {
514
+ if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
515
+ return value
516
+ .map(
517
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
518
+ )
519
+ .join('&');
520
+ }
521
+ return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
522
+ })
523
+ .join('&');
524
+ return (
525
+ baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
526
+ );
527
+ };
528
+
529
+ private $headers = (
530
+ headerParameters: { [key: string]: any },
531
+ collectionFormats?: { [key: string]: 'multi' | 'csv' },
532
+ ): [string, string][] => {
533
+ return Object.entries(headerParameters).flatMap(([key, value]) => {
534
+ if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
535
+ return value.map((v) => [key, String(v)]) as [string, string][];
536
+ }
537
+ return [[key, String(value)]];
538
+ });
539
+ };
540
+
541
+ private $fetch: typeof fetch = (...args) =>
542
+ (this.$config.fetch ?? fetch)(...args);
543
+
544
+ public async testAnyOfAny(
545
+ input?: TestAnyOfAnyRequest,
546
+ ): Promise<TestAnyOfAny200Response> {
547
+ const pathParameters: { [key: string]: any } = {};
548
+ const queryParameters: { [key: string]: any } = {};
549
+ const headerParameters: { [key: string]: any } = {};
550
+ if (!this.$config.options?.omitContentTypeHeader) {
551
+ headerParameters['Content-Type'] = 'application/json';
552
+ }
553
+ const body =
554
+ input === undefined
555
+ ? undefined
556
+ : typeof input === 'object'
557
+ ? JSON.stringify($IO.TestAnyOfAnyRequestContent.toJson(input))
558
+ : String($IO.TestAnyOfAnyRequestContent.toJson(input));
559
+
560
+ const response = await this.$fetch(
561
+ this.$url('/anyOfAny', pathParameters, queryParameters),
562
+ {
563
+ headers: this.$headers(headerParameters),
564
+ method: 'POST',
565
+ body,
566
+ },
567
+ );
568
+
569
+ if (response.status === 200) {
570
+ return $IO.TestAnyOfAny200Response.fromJson(await response.json());
571
+ }
572
+ throw new Error(
573
+ \`Unknown response status \${response.status} returned by API\`,
574
+ );
575
+ }
576
+ }
577
+ "
578
+ `;
579
+
580
+ exports[`openApiTsClientGenerator - composite schemas > should handle anyOf with enums 1`] = `
581
+ "export type TestAnyOfEnum200Response = {
582
+ result?: string;
583
+ };
584
+ export type TestAnyOfEnumRequestContent = {
585
+ anyType?: TestAnyOfEnumRequestContentAnyType;
586
+ };
587
+ export type TestAnyOfEnumRequestContentAnyType =
588
+ TestAnyOfEnumRequestContentAnyTypeAnyOf | null;
589
+ export type TestAnyOfEnumRequestContentAnyTypeAnyOf = 'a' | 'b' | 'c';
590
+
591
+ export type TestAnyOfEnumRequest = TestAnyOfEnumRequestContent | undefined;
592
+ export type TestAnyOfEnumError = never;
593
+ "
594
+ `;
595
+
596
+ exports[`openApiTsClientGenerator - composite schemas > should handle anyOf with enums 2`] = `
597
+ "import type {
598
+ TestAnyOfEnum200Response,
599
+ TestAnyOfEnumRequestContent,
600
+ TestAnyOfEnumRequestContentAnyType,
601
+ TestAnyOfEnumRequest,
602
+ } from './types.gen.js';
603
+
604
+ /**
605
+ * Utility for serialisation and deserialisation of API types.
606
+ */
607
+ export class $IO {
608
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
609
+ Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
610
+
611
+ public static TestAnyOfEnum200Response = {
612
+ toJson: (model: TestAnyOfEnum200Response): any => {
613
+ if (model === undefined || model === null) {
614
+ return model;
615
+ }
616
+ return {
617
+ ...(model.result === undefined
618
+ ? {}
619
+ : {
620
+ result: model.result,
621
+ }),
622
+ };
623
+ },
624
+ fromJson: (json: any): TestAnyOfEnum200Response => {
625
+ if (json === undefined || json === null) {
626
+ return json;
627
+ }
628
+ return {
629
+ ...(json['result'] === undefined
630
+ ? {}
631
+ : {
632
+ result: json['result'],
633
+ }),
634
+ };
635
+ },
636
+ };
637
+
638
+ public static TestAnyOfEnumRequestContent = {
639
+ toJson: (model: TestAnyOfEnumRequestContent): any => {
640
+ if (model === undefined || model === null) {
641
+ return model;
642
+ }
643
+ return {
644
+ ...(model.anyType === undefined
645
+ ? {}
646
+ : {
647
+ anyType: $IO.TestAnyOfEnumRequestContentAnyType.toJson(
648
+ model.anyType,
649
+ ),
650
+ }),
651
+ };
652
+ },
653
+ fromJson: (json: any): TestAnyOfEnumRequestContent => {
654
+ if (json === undefined || json === null) {
655
+ return json;
656
+ }
657
+ return {
658
+ ...(json['anyType'] === undefined
659
+ ? {}
660
+ : {
661
+ anyType: $IO.TestAnyOfEnumRequestContentAnyType.fromJson(
662
+ json['anyType'],
663
+ ),
664
+ }),
665
+ };
666
+ },
667
+ };
668
+
669
+ public static TestAnyOfEnumRequestContentAnyType = {
670
+ toJson: (model: TestAnyOfEnumRequestContentAnyType): any => {
671
+ if (model === undefined || model === null) {
672
+ return model;
673
+ }
674
+ if (typeof model === 'string') {
675
+ return model;
676
+ }
677
+ return model;
678
+ },
679
+ fromJson: (json: any): TestAnyOfEnumRequestContentAnyType => {
680
+ if (json === undefined || json === null) {
681
+ return json;
682
+ }
683
+ return json;
684
+ },
685
+ };
686
+ }
687
+
688
+ /**
689
+ * Client configuration for TestApi
690
+ */
691
+ export interface TestApiConfig {
692
+ /**
693
+ * Base URL for the API
694
+ */
695
+ url: string;
696
+ /**
697
+ * Custom instance of fetch. By default the global 'fetch' is used.
698
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
699
+ */
700
+ fetch?: typeof fetch;
701
+ /**
702
+ * Additional configuration
703
+ */
704
+ options?: {
705
+ /**
706
+ * By default, the client will add a Content-Type header, set to the media type defined for
707
+ * the request in the OpenAPI specification.
708
+ * Set this to false to omit this header.
709
+ */
710
+ omitContentTypeHeader?: boolean;
711
+ };
712
+ }
713
+
714
+ /**
715
+ * API Client for TestApi
716
+ */
717
+ export class TestApi {
718
+ private $config: TestApiConfig;
719
+
720
+ constructor(config: TestApiConfig) {
721
+ this.$config = config;
722
+
723
+ this.testAnyOfEnum = this.testAnyOfEnum.bind(this);
724
+ }
725
+
726
+ private $url = (
727
+ path: string,
728
+ pathParameters: { [key: string]: any },
729
+ queryParameters: { [key: string]: any },
730
+ collectionFormats?: { [key: string]: 'multi' | 'csv' },
731
+ ): string => {
732
+ const baseUrl = this.$config.url.endsWith('/')
733
+ ? this.$config.url.slice(0, -1)
734
+ : this.$config.url;
735
+ const pathWithParameters = Object.entries(pathParameters).reduce(
736
+ (withParams, [key, value]) =>
737
+ withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
738
+ path,
739
+ );
740
+ const queryString = Object.entries(queryParameters)
741
+ .map(([key, value]) => {
742
+ if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
743
+ return value
744
+ .map(
745
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
746
+ )
747
+ .join('&');
748
+ }
749
+ return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
750
+ })
751
+ .join('&');
752
+ return (
753
+ baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
754
+ );
755
+ };
756
+
757
+ private $headers = (
758
+ headerParameters: { [key: string]: any },
759
+ collectionFormats?: { [key: string]: 'multi' | 'csv' },
760
+ ): [string, string][] => {
761
+ return Object.entries(headerParameters).flatMap(([key, value]) => {
762
+ if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
763
+ return value.map((v) => [key, String(v)]) as [string, string][];
764
+ }
765
+ return [[key, String(value)]];
766
+ });
767
+ };
768
+
769
+ private $fetch: typeof fetch = (...args) =>
770
+ (this.$config.fetch ?? fetch)(...args);
771
+
772
+ public async testAnyOfEnum(
773
+ input?: TestAnyOfEnumRequest,
774
+ ): Promise<TestAnyOfEnum200Response> {
775
+ const pathParameters: { [key: string]: any } = {};
776
+ const queryParameters: { [key: string]: any } = {};
777
+ const headerParameters: { [key: string]: any } = {};
778
+ if (!this.$config.options?.omitContentTypeHeader) {
779
+ headerParameters['Content-Type'] = 'application/json';
780
+ }
781
+ const body =
782
+ input === undefined
783
+ ? undefined
784
+ : typeof input === 'object'
785
+ ? JSON.stringify($IO.TestAnyOfEnumRequestContent.toJson(input))
786
+ : String($IO.TestAnyOfEnumRequestContent.toJson(input));
787
+
788
+ const response = await this.$fetch(
789
+ this.$url('/anyOfEnum', pathParameters, queryParameters),
790
+ {
791
+ headers: this.$headers(headerParameters),
792
+ method: 'POST',
793
+ body,
794
+ },
795
+ );
796
+
797
+ if (response.status === 200) {
798
+ return $IO.TestAnyOfEnum200Response.fromJson(await response.json());
799
+ }
800
+ throw new Error(
801
+ \`Unknown response status \${response.status} returned by API\`,
802
+ );
803
+ }
804
+ }
805
+ "
806
+ `;
807
+
359
808
  exports[`openApiTsClientGenerator - composite schemas > should handle composite primitive and array request bodies 1`] = `
360
809
  "export type CompositeRequestContent =
361
810
  | string
@@ -738,7 +1187,6 @@ exports[`openApiTsClientGenerator - composite schemas > should handle inline pri
738
1187
  TestComposites200ResponseAnyOf,
739
1188
  TestComposites200ResponseAnyOf1,
740
1189
  TestCompositesRequestContent,
741
- TestCompositesRequestContentOneOf,
742
1190
  TestEnums200Response,
743
1191
  TestArraysRequest,
744
1192
  TestArraysWithOtherParametersRequest,
@@ -953,9 +1401,6 @@ export class $IO {
953
1401
  if (typeof json === 'string') {
954
1402
  return json;
955
1403
  }
956
- if (typeof json === 'string') {
957
- return json;
958
- }
959
1404
  return json;
960
1405
  },
961
1406
  };
@@ -752,6 +752,207 @@ export class TestApi {
752
752
  "
753
753
  `;
754
754
 
755
+ exports[`openApiTsClientGenerator - primitive types > should handle enum reference properties 1`] = `
756
+ "export type MyStatus = 'success' | 'failed' | 'pending';
757
+ export type UpdateStatus200Response = {
758
+ status?: MyStatus;
759
+ };
760
+ export type UpdateStatusRequestContent = {
761
+ status?: MyStatus;
762
+ };
763
+
764
+ export type UpdateStatusRequest = UpdateStatusRequestContent;
765
+ export type UpdateStatusError = never;
766
+ "
767
+ `;
768
+
769
+ exports[`openApiTsClientGenerator - primitive types > should handle enum reference properties 2`] = `
770
+ "import type {
771
+ UpdateStatus200Response,
772
+ UpdateStatusRequestContent,
773
+ UpdateStatusRequest,
774
+ } from './types.gen.js';
775
+
776
+ /**
777
+ * Utility for serialisation and deserialisation of API types.
778
+ */
779
+ export class $IO {
780
+ protected static $mapValues = (data: any, fn: (item: any) => any) =>
781
+ Object.fromEntries(Object.entries(data).map(([k, v]) => [k, fn(v)]));
782
+
783
+ public static UpdateStatus200Response = {
784
+ toJson: (model: UpdateStatus200Response): any => {
785
+ if (model === undefined || model === null) {
786
+ return model;
787
+ }
788
+ return {
789
+ ...(model.status === undefined
790
+ ? {}
791
+ : {
792
+ status: model.status,
793
+ }),
794
+ };
795
+ },
796
+ fromJson: (json: any): UpdateStatus200Response => {
797
+ if (json === undefined || json === null) {
798
+ return json;
799
+ }
800
+ return {
801
+ ...(json['status'] === undefined
802
+ ? {}
803
+ : {
804
+ status: json['status'],
805
+ }),
806
+ };
807
+ },
808
+ };
809
+
810
+ public static UpdateStatusRequestContent = {
811
+ toJson: (model: UpdateStatusRequestContent): any => {
812
+ if (model === undefined || model === null) {
813
+ return model;
814
+ }
815
+ return {
816
+ ...(model.status === undefined
817
+ ? {}
818
+ : {
819
+ status: model.status,
820
+ }),
821
+ };
822
+ },
823
+ fromJson: (json: any): UpdateStatusRequestContent => {
824
+ if (json === undefined || json === null) {
825
+ return json;
826
+ }
827
+ return {
828
+ ...(json['status'] === undefined
829
+ ? {}
830
+ : {
831
+ status: json['status'],
832
+ }),
833
+ };
834
+ },
835
+ };
836
+ }
837
+
838
+ /**
839
+ * Client configuration for TestApi
840
+ */
841
+ export interface TestApiConfig {
842
+ /**
843
+ * Base URL for the API
844
+ */
845
+ url: string;
846
+ /**
847
+ * Custom instance of fetch. By default the global 'fetch' is used.
848
+ * You can override this to add custom middleware for use cases such as adding authentication headers.
849
+ */
850
+ fetch?: typeof fetch;
851
+ /**
852
+ * Additional configuration
853
+ */
854
+ options?: {
855
+ /**
856
+ * By default, the client will add a Content-Type header, set to the media type defined for
857
+ * the request in the OpenAPI specification.
858
+ * Set this to false to omit this header.
859
+ */
860
+ omitContentTypeHeader?: boolean;
861
+ };
862
+ }
863
+
864
+ /**
865
+ * API Client for TestApi
866
+ */
867
+ export class TestApi {
868
+ private $config: TestApiConfig;
869
+
870
+ constructor(config: TestApiConfig) {
871
+ this.$config = config;
872
+
873
+ this.updateStatus = this.updateStatus.bind(this);
874
+ }
875
+
876
+ private $url = (
877
+ path: string,
878
+ pathParameters: { [key: string]: any },
879
+ queryParameters: { [key: string]: any },
880
+ collectionFormats?: { [key: string]: 'multi' | 'csv' },
881
+ ): string => {
882
+ const baseUrl = this.$config.url.endsWith('/')
883
+ ? this.$config.url.slice(0, -1)
884
+ : this.$config.url;
885
+ const pathWithParameters = Object.entries(pathParameters).reduce(
886
+ (withParams, [key, value]) =>
887
+ withParams.replace(\`{\${key}}\`, encodeURIComponent(\`\${value}\`)),
888
+ path,
889
+ );
890
+ const queryString = Object.entries(queryParameters)
891
+ .map(([key, value]) => {
892
+ if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
893
+ return value
894
+ .map(
895
+ (v) => \`\${encodeURIComponent(key)}=\${encodeURIComponent(\`\${v}\`)}\`,
896
+ )
897
+ .join('&');
898
+ }
899
+ return \`\${encodeURIComponent(key)}=\${encodeURIComponent(Array.isArray(value) ? value.map(String).join(',') : String(value))}\`;
900
+ })
901
+ .join('&');
902
+ return (
903
+ baseUrl + pathWithParameters + (queryString ? \`?\${queryString}\` : '')
904
+ );
905
+ };
906
+
907
+ private $headers = (
908
+ headerParameters: { [key: string]: any },
909
+ collectionFormats?: { [key: string]: 'multi' | 'csv' },
910
+ ): [string, string][] => {
911
+ return Object.entries(headerParameters).flatMap(([key, value]) => {
912
+ if (Array.isArray(value) && collectionFormats?.[key] === 'multi') {
913
+ return value.map((v) => [key, String(v)]) as [string, string][];
914
+ }
915
+ return [[key, String(value)]];
916
+ });
917
+ };
918
+
919
+ private $fetch: typeof fetch = (...args) =>
920
+ (this.$config.fetch ?? fetch)(...args);
921
+
922
+ public async updateStatus(
923
+ input: UpdateStatusRequest,
924
+ ): Promise<UpdateStatus200Response> {
925
+ const pathParameters: { [key: string]: any } = {};
926
+ const queryParameters: { [key: string]: any } = {};
927
+ const headerParameters: { [key: string]: any } = {};
928
+ if (!this.$config.options?.omitContentTypeHeader) {
929
+ headerParameters['Content-Type'] = 'application/json';
930
+ }
931
+ const body =
932
+ typeof input === 'object'
933
+ ? JSON.stringify($IO.UpdateStatusRequestContent.toJson(input))
934
+ : String($IO.UpdateStatusRequestContent.toJson(input));
935
+
936
+ const response = await this.$fetch(
937
+ this.$url('/status', pathParameters, queryParameters),
938
+ {
939
+ headers: this.$headers(headerParameters),
940
+ method: 'POST',
941
+ body,
942
+ },
943
+ );
944
+
945
+ if (response.status === 200) {
946
+ return $IO.UpdateStatus200Response.fromJson(await response.json());
947
+ }
948
+ throw new Error(
949
+ \`Unknown response status \${response.status} returned by API\`,
950
+ );
951
+ }
952
+ }
953
+ "
954
+ `;
955
+
755
956
  exports[`openApiTsClientGenerator - primitive types > should handle enum request and response bodies 1`] = `
756
957
  "export type UpdateStatus200Response = 'accepted' | 'rejected';
757
958
  export type UpdateStatusRequestContent =
@@ -768,7 +969,6 @@ export type UpdateStatusError = never;
768
969
  exports[`openApiTsClientGenerator - primitive types > should handle enum request and response bodies 2`] = `
769
970
  "import type {
770
971
  UpdateStatus200Response,
771
- UpdateStatusRequestContent,
772
972
  UpdateStatusRequest,
773
973
  } from './types.gen.js';
774
974
 
@@ -587,7 +587,6 @@ exports[`openApiTsClientGenerator - streaming > should return an iterator over a
587
587
  GetBooleanDict200Response,
588
588
  GetDateDict200Response,
589
589
  GetEnumDict200Response,
590
- GetEnumDict200ResponseValue,
591
590
  GetNestedDict200Response,
592
591
  GetNestedDict200ResponseValueValue,
593
592
  GetNumberDict200Response,
@@ -16,10 +16,11 @@ const uniqStrings = (strings) => {
16
16
  return true;
17
17
  });
18
18
  };
19
+ const returnTypeSet = new Set(allOperations.map(op => op.result.typescriptType));
19
20
  _%>
20
21
  <%_ if ((models.length + allOperations.filter(p => p.parameters.length > 0).length) > 0) { _%>
21
22
  import type {
22
- <%_ models.forEach((model) => { _%>
23
+ <%_ models.filter(model => model.export !== 'enum' || returnTypeSet.has(model.name)).forEach((model) => { _%>
23
24
  <%- model.name %>,
24
25
  <%_ }) _%>
25
26
  <%_ allOperations.filter(p => p.parameters.length > 0).forEach((op) => { _%>
@@ -173,7 +174,7 @@ export class $IO {
173
174
  return model;
174
175
  }
175
176
  <%_ if (isComposite) { _%>
176
- <%_ model.composedPrimitives.filter(p => !['array', 'dictionary'].includes(p.export) && p.type !== 'null').forEach((primitive) => { _%>
177
+ <%_ model.composedPrimitives.filter(p => !['array', 'dictionary'].includes(p.export) && !['null', 'unknown'].includes(p.type)).forEach((primitive) => { _%>
177
178
  if (typeof model === "<%- primitive.typescriptType %>") {
178
179
  return model;
179
180
  }
@@ -232,7 +233,7 @@ export class $IO {
232
233
  return json;
233
234
  }
234
235
  <%_ if (isComposite) { _%>
235
- <%_ model.composedPrimitives.filter(p => !['array', 'dictionary'].includes(p.export) && p.type !== 'null').forEach((primitive) => { _%>
236
+ <%_ model.composedPrimitives.filter(p => !['array', 'dictionary', 'enum'].includes(p.export) && !['null', 'unknown'].includes(p.type)).forEach((primitive) => { _%>
236
237
  if (typeof json === "<%- primitive.typescriptType %>") {
237
238
  return json;
238
239
  }