@@ -606,29 +606,114 @@ export const ResponsesDefinitionsObject: t.Type<TResponsesDefinitionsObject, mix
606
606
ResponseObject ,
607
607
) ;
608
608
609
- export type TScopeaObject = TDictionary < string > ;
610
- export const ScopesObject : t . Type < TScopeaObject , mixed > = t . dictionary ( t . string , t . string ) ;
609
+ export type TScopesObject = TDictionary < string > ;
610
+ export const ScopesObject : t . Type < TScopesObject , mixed > = t . dictionary ( t . string , t . string ) ;
611
611
612
- export type TSecuritySchemeObject = {
613
- type : 'basic' | 'apiKey' | 'oauth2' ;
612
+ //#region SecuritySchemeObject
613
+
614
+ export type TBaseSecuritySchemeObjectProps = {
614
615
description : Option < string > ;
615
- name : string ;
616
- in : 'query' | 'header' ;
617
- flow : 'implicit' | 'password' | 'application' | 'accessCode' ;
618
- authorizationUrl : string ;
619
- tokenUrl : string ;
620
- scopes : TScopeaObject ;
621
616
} ;
622
- export const SecuritySchemeObject : t . Type < TSecuritySchemeObject , mixed > = t . type ( {
623
- type : t . union ( [ t . literal ( 'basic' ) , t . literal ( 'apiKey' ) , t . literal ( 'oauth2' ) ] ) ,
617
+ const BaseSecuritySchemeObjectProps = {
624
618
description : stringOption ,
625
- name : t . string ,
619
+ } ;
620
+ ( ) : t . Type < TBaseSecuritySchemeObjectProps , mixed > => t . type ( BaseSecuritySchemeObjectProps ) ; //tslint:disable-line no-unused-expression (integrity check)
621
+
622
+ export type TBasicSecuritySchemeObject = TBaseSecuritySchemeObjectProps & {
623
+ type : 'basic' ;
624
+ } ;
625
+ const BasicSecuritySchemeObject : t . Tagged < 'type' , TBasicSecuritySchemeObject , mixed > = t . type ( {
626
+ ...BaseSecuritySchemeObjectProps ,
627
+ type : t . literal ( 'basic' ) ,
628
+ } ) ;
629
+
630
+ export type TApiKeySecuritySchemeObject = TBaseSecuritySchemeObjectProps & {
631
+ type : 'apiKey' ;
632
+ in : 'query' | 'header' ;
633
+ name : string ;
634
+ } ;
635
+ const ApiKeySecuritySchemeObject : t . Tagged < 'type' , TApiKeySecuritySchemeObject , mixed > = t . type ( {
636
+ ...BaseSecuritySchemeObjectProps ,
637
+ type : t . literal ( 'apiKey' ) ,
626
638
in : t . union ( [ t . literal ( 'query' ) , t . literal ( 'header' ) ] ) ,
627
- flow : t . union ( [ t . literal ( 'implicit' ) , t . literal ( 'password' ) , t . literal ( 'application' ) , t . literal ( 'accessCode' ) ] ) ,
639
+ name : t . string ,
640
+ } ) ;
641
+
642
+ export type TImplicitOAuth2SecuritySchemeObject = TBaseSecuritySchemeObjectProps & {
643
+ type : 'oauth2' ;
644
+ flow : 'implicit' ;
645
+ authorizationUrl : string ;
646
+ scopes : TScopesObject ;
647
+ } ;
648
+ const ImplicitOAuth2SecuritySchemeObject : t . Tagged < 'flow' , TImplicitOAuth2SecuritySchemeObject , mixed > = t . type ( {
649
+ ...BaseSecuritySchemeObjectProps ,
650
+ type : t . literal ( 'oauth2' ) ,
651
+ flow : t . literal ( 'implicit' ) ,
628
652
authorizationUrl : t . string ,
653
+ scopes : ScopesObject ,
654
+ } ) ;
655
+ export type TPasswordOAuth2SecuritySchemeObject = TBaseSecuritySchemeObjectProps & {
656
+ type : 'oauth2' ;
657
+ flow : 'password' ;
658
+ tokenUrl : string ;
659
+ scopes : TScopesObject ;
660
+ } ;
661
+ const PasswordOAuth2SecuritySchemeObject : t . Tagged < 'flow' , TPasswordOAuth2SecuritySchemeObject , mixed > = t . type ( {
662
+ ...BaseSecuritySchemeObjectProps ,
663
+ type : t . literal ( 'oauth2' ) ,
664
+ flow : t . literal ( 'password' ) ,
665
+ tokenUrl : t . string ,
666
+ scopes : ScopesObject ,
667
+ } ) ;
668
+ export type TApplicationOAuth2SecuritySchemeObject = TBaseSecuritySchemeObjectProps & {
669
+ type : 'oauth2' ;
670
+ flow : 'application' ;
671
+ tokenUrl : string ;
672
+ scopes : TScopesObject ;
673
+ } ;
674
+ const ApplicationOAuth2SecuritySchemeObject : t . Tagged < 'flow' , TApplicationOAuth2SecuritySchemeObject , mixed > = t . type ( {
675
+ ...BaseSecuritySchemeObjectProps ,
676
+ type : t . literal ( 'oauth2' ) ,
677
+ flow : t . literal ( 'application' ) ,
629
678
tokenUrl : t . string ,
630
679
scopes : ScopesObject ,
631
680
} ) ;
681
+ export type TAccessCodeOAuth2SecuritySchemeObject = TBaseSecuritySchemeObjectProps & {
682
+ type : 'oauth2' ;
683
+ flow : 'accessCode' ;
684
+ tokenUrl : string ;
685
+ scopes : TScopesObject ;
686
+ } ;
687
+ const AccessCodeOAuth2SecuritySchemeObject : t . Tagged < 'flow' , TAccessCodeOAuth2SecuritySchemeObject , mixed > = t . type ( {
688
+ ...BaseSecuritySchemeObjectProps ,
689
+ type : t . literal ( 'oauth2' ) ,
690
+ flow : t . literal ( 'accessCode' ) ,
691
+ tokenUrl : t . string ,
692
+ scopes : ScopesObject ,
693
+ } ) ;
694
+ export type TOAuth2SecuritySchemeObject =
695
+ | TImplicitOAuth2SecuritySchemeObject
696
+ | TPasswordOAuth2SecuritySchemeObject
697
+ | TApplicationOAuth2SecuritySchemeObject
698
+ | TAccessCodeOAuth2SecuritySchemeObject ;
699
+ const OAuth2SecuritySchemeObject : t . Tagged < 'type' , TOAuth2SecuritySchemeObject , mixed > = t . taggedUnion ( 'flow' , [
700
+ ImplicitOAuth2SecuritySchemeObject ,
701
+ PasswordOAuth2SecuritySchemeObject ,
702
+ ApplicationOAuth2SecuritySchemeObject ,
703
+ AccessCodeOAuth2SecuritySchemeObject ,
704
+ ] ) as any ;
705
+
706
+ export type TSecuritySchemeObject =
707
+ | TBasicSecuritySchemeObject
708
+ | TApiKeySecuritySchemeObject
709
+ | TOAuth2SecuritySchemeObject ;
710
+ const SecuritySchemeObject : t . Type < TSecuritySchemeObject , mixed > = t . taggedUnion ( 'type' , [
711
+ BasicSecuritySchemeObject ,
712
+ ApiKeySecuritySchemeObject ,
713
+ OAuth2SecuritySchemeObject ,
714
+ ] ) ;
715
+
716
+ //#endregion
632
717
633
718
export type TSecurityDefinitionsObject = TDictionary < TSecuritySchemeObject > ;
634
719
export const SecurityDefinitionsObject : t . Type < TSecurityDefinitionsObject , mixed > = t . dictionary (
0 commit comments