@@ -8,58 +8,50 @@ import Foundation
88
99/// Datatypes and serializers for the openid namespace
1010open class Openid {
11- /// The AuthError union
12- public enum AuthError : CustomStringConvertible {
13- /// An unspecified error.
14- case invalidToken
15- /// An unspecified error.
16- case noOpenidAuth
11+ /// The OpenIdError union
12+ public enum OpenIdError : CustomStringConvertible {
13+ /// Missing openid claims for the associated access token.
14+ case incorrectOpenidScopes
1715 /// An unspecified error.
1816 case other
1917
2018 public var description : String {
21- return " \( SerializeUtil . prepareJSONForSerialization ( AuthErrorSerializer ( ) . serialize ( self ) ) ) "
19+ return " \( SerializeUtil . prepareJSONForSerialization ( OpenIdErrorSerializer ( ) . serialize ( self ) ) ) "
2220 }
2321 }
24- open class AuthErrorSerializer : JSONSerializer {
22+ open class OpenIdErrorSerializer : JSONSerializer {
2523 public init ( ) { }
26- open func serialize( _ value: AuthError ) -> JSON {
24+ open func serialize( _ value: OpenIdError ) -> JSON {
2725 switch value {
28- case . invalidToken:
29- var d = [ String: JSON] ( )
30- d [ " .tag " ] = . str( " invalid_token " )
31- return . dictionary( d)
32- case . noOpenidAuth:
26+ case . incorrectOpenidScopes:
3327 var d = [ String: JSON] ( )
34- d [ " .tag " ] = . str( " no_openid_auth " )
28+ d [ " .tag " ] = . str( " incorrect_openid_scopes " )
3529 return . dictionary( d)
3630 case . other:
3731 var d = [ String: JSON] ( )
3832 d [ " .tag " ] = . str( " other " )
3933 return . dictionary( d)
4034 }
4135 }
42- open func deserialize( _ json: JSON ) -> AuthError {
36+ open func deserialize( _ json: JSON ) -> OpenIdError {
4337 switch json {
4438 case . dictionary( let d) :
4539 let tag = Serialization . getTag ( d)
4640 switch tag {
47- case " invalid_token " :
48- return AuthError . invalidToken
49- case " no_openid_auth " :
50- return AuthError . noOpenidAuth
41+ case " incorrect_openid_scopes " :
42+ return OpenIdError . incorrectOpenidScopes
5143 case " other " :
52- return AuthError . other
44+ return OpenIdError . other
5345 default :
54- return AuthError . other
46+ return OpenIdError . other
5547 }
5648 default :
5749 fatalError ( " Failed to deserialize " )
5850 }
5951 }
6052 }
6153
62- /// This struct is empty. The comment here is intentionally emitted to avoid indentation issues with Stone.
54+ /// No Parameters
6355 open class UserInfoArgs : CustomStringConvertible {
6456 public init ( ) {
6557 }
@@ -83,38 +75,46 @@ open class Openid {
8375 }
8476 }
8577
86- /// The UserInfoError struct
87- open class UserInfoError : CustomStringConvertible {
88- /// (no description)
89- public let err : Openid . ErrUnion ?
90- /// Brief explanation of the error.
91- public let errorMessage : String
92- public init ( err: Openid . ErrUnion ? = nil , errorMessage: String = " " ) {
93- self . err = err
94- stringValidator ( ) ( errorMessage)
95- self . errorMessage = errorMessage
96- }
97- open var description : String {
78+ /// The UserInfoError union
79+ public enum UserInfoError : CustomStringConvertible {
80+ /// An unspecified error.
81+ case openidError( Openid . OpenIdError )
82+ /// An unspecified error.
83+ case other
84+
85+ public var description : String {
9886 return " \( SerializeUtil . prepareJSONForSerialization ( UserInfoErrorSerializer ( ) . serialize ( self ) ) ) "
9987 }
10088 }
10189 open class UserInfoErrorSerializer : JSONSerializer {
10290 public init ( ) { }
10391 open func serialize( _ value: UserInfoError ) -> JSON {
104- let output = [
105- " err " : NullableSerializer ( Openid . ErrUnionSerializer ( ) ) . serialize ( value. err) ,
106- " error_message " : Serialization . _StringSerializer. serialize ( value. errorMessage) ,
107- ]
108- return . dictionary( output)
92+ switch value {
93+ case . openidError( let arg) :
94+ var d = [ " openid_error " : Openid . OpenIdErrorSerializer ( ) . serialize ( arg) ]
95+ d [ " .tag " ] = . str( " openid_error " )
96+ return . dictionary( d)
97+ case . other:
98+ var d = [ String: JSON] ( )
99+ d [ " .tag " ] = . str( " other " )
100+ return . dictionary( d)
101+ }
109102 }
110103 open func deserialize( _ json: JSON ) -> UserInfoError {
111104 switch json {
112- case . dictionary( let dict) :
113- let err = NullableSerializer ( Openid . ErrUnionSerializer ( ) ) . deserialize ( dict [ " err " ] ?? . null)
114- let errorMessage = Serialization . _StringSerializer. deserialize ( dict [ " error_message " ] ?? . str( " " ) )
115- return UserInfoError ( err: err, errorMessage: errorMessage)
105+ case . dictionary( let d) :
106+ let tag = Serialization . getTag ( d)
107+ switch tag {
108+ case " openid_error " :
109+ let v = Openid . OpenIdErrorSerializer ( ) . deserialize ( d [ " openid_error " ] ?? . null)
110+ return UserInfoError . openidError ( v)
111+ case " other " :
112+ return UserInfoError . other
113+ default :
114+ return UserInfoError . other
115+ }
116116 default :
117- fatalError ( " Type error deserializing " )
117+ fatalError ( " Failed to deserialize " )
118118 }
119119 }
120120 }
@@ -180,50 +180,6 @@ open class Openid {
180180 }
181181 }
182182
183- /// The ErrUnion union
184- public enum ErrUnion : CustomStringConvertible {
185- /// An unspecified error.
186- case authError( Openid . AuthError )
187- /// An unspecified error.
188- case other
189-
190- public var description : String {
191- return " \( SerializeUtil . prepareJSONForSerialization ( ErrUnionSerializer ( ) . serialize ( self ) ) ) "
192- }
193- }
194- open class ErrUnionSerializer : JSONSerializer {
195- public init ( ) { }
196- open func serialize( _ value: ErrUnion ) -> JSON {
197- switch value {
198- case . authError( let arg) :
199- var d = [ " auth_error " : Openid . AuthErrorSerializer ( ) . serialize ( arg) ]
200- d [ " .tag " ] = . str( " auth_error " )
201- return . dictionary( d)
202- case . other:
203- var d = [ String: JSON] ( )
204- d [ " .tag " ] = . str( " other " )
205- return . dictionary( d)
206- }
207- }
208- open func deserialize( _ json: JSON ) -> ErrUnion {
209- switch json {
210- case . dictionary( let d) :
211- let tag = Serialization . getTag ( d)
212- switch tag {
213- case " auth_error " :
214- let v = Openid . AuthErrorSerializer ( ) . deserialize ( d [ " auth_error " ] ?? . null)
215- return ErrUnion . authError ( v)
216- case " other " :
217- return ErrUnion . other
218- default :
219- return ErrUnion . other
220- }
221- default :
222- fatalError ( " Failed to deserialize " )
223- }
224- }
225- }
226-
227183
228184 /// Stone Route Objects
229185
0 commit comments