@@ -694,6 +694,102 @@ export type operations = Record<string, never>;`,
694
694
} ,
695
695
} ,
696
696
] ,
697
+ [
698
+ "nullable > basic" ,
699
+ {
700
+ given : {
701
+ openapi : "3.1" ,
702
+ info : { title : "Test" , version : "1.0" } ,
703
+ components : {
704
+ schemas : {
705
+ NullableEmptyObject : {
706
+ nullable : true ,
707
+ properties : { } ,
708
+ title : "NullableEmptyObject" ,
709
+ type : "object" ,
710
+ } ,
711
+ NullableObject : {
712
+ nullable : true ,
713
+ properties : {
714
+ name : {
715
+ type : "string" ,
716
+ } ,
717
+ } ,
718
+ title : "NullableObject" ,
719
+ type : "object" ,
720
+ } ,
721
+ NullableString : {
722
+ nullable : true ,
723
+ title : "NullableString" ,
724
+ type : "string" ,
725
+ } ,
726
+ } ,
727
+ } ,
728
+ } ,
729
+ want : `export type paths = Record<string, never>;
730
+ export type webhooks = Record<string, never>;
731
+ export interface components {
732
+ schemas: {
733
+ /** NullableEmptyObject */
734
+ NullableEmptyObject: Record<string, never> | null;
735
+ /** NullableObject */
736
+ NullableObject: {
737
+ name?: string;
738
+ } | null;
739
+ /** NullableString */
740
+ NullableString: string | null;
741
+ };
742
+ responses: never;
743
+ parameters: never;
744
+ requestBodies: never;
745
+ headers: never;
746
+ pathItems: never;
747
+ }
748
+ export type $defs = Record<string, never>;
749
+ export type operations = Record<string, never>;` ,
750
+ } ,
751
+ ] ,
752
+ [
753
+ "nullable > object with ref" ,
754
+ {
755
+ given : {
756
+ openapi : "3.1" ,
757
+ info : { title : "Test" , version : "0" } ,
758
+ components : {
759
+ schemas : {
760
+ obj1Ref : {
761
+ properties : {
762
+ id : { type : "string" } ,
763
+ } ,
764
+ } ,
765
+ obj1 : {
766
+ type : "object" ,
767
+ nullable : true ,
768
+ $ref : "#/components/schemas/obj1Ref" ,
769
+ } ,
770
+ } ,
771
+ } ,
772
+ paths : { } ,
773
+ } ,
774
+ want : `export type paths = Record<string, never>;
775
+ export type webhooks = Record<string, never>;
776
+ export interface components {
777
+ schemas: {
778
+ obj1Ref: {
779
+ id?: string;
780
+ };
781
+ obj1: components["schemas"]["obj1Ref"] | null;
782
+ };
783
+ responses: never;
784
+ parameters: never;
785
+ requestBodies: never;
786
+ headers: never;
787
+ pathItems: never;
788
+ }
789
+ export type $defs = Record<string, never>;
790
+ export type operations = Record<string, never>;` ,
791
+ } ,
792
+ ] ,
697
793
] ;
698
794
699
795
for ( const [ testName , { given, want, options, ci } ] of tests ) {
0 commit comments