generated from etclabscore/pristine-typescript
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes: #382
- Loading branch information
Showing
10 changed files
with
134 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
import "encoding/json" | ||
import "errors" | ||
type StringDoaGddGA string | ||
type OneOfMoebiusSchemaStringDoaGddGANK2MA6NR struct { | ||
MoebiusSchema *MoebiusSchema | ||
StringDoaGddGA *StringDoaGddGA | ||
} | ||
// UnmarshalJSON implements the json Unmarshaler interface. | ||
// This implementation DOES NOT assert that ONE AND ONLY ONE | ||
// of the simple properties is satisfied; it lazily uses the first one that is satisfied. | ||
// Ergo, it will not return an error if more than one property is valid. | ||
func (o *OneOfMoebiusSchemaStringDoaGddGANK2MA6NR) UnmarshalJSON(bytes []byte) error { | ||
var myMoebiusSchema MoebiusSchema | ||
if err := json.Unmarshal(bytes, &myMoebiusSchema); err == nil { | ||
o.MoebiusSchema = &myMoebiusSchema | ||
return nil | ||
} | ||
var myStringDoaGddGA StringDoaGddGA | ||
if err := json.Unmarshal(bytes, &myStringDoaGddGA); err == nil { | ||
o.StringDoaGddGA = &myStringDoaGddGA | ||
return nil | ||
} | ||
return errors.New("failed to unmarshal one of the object properties") | ||
} | ||
func (o OneOfMoebiusSchemaStringDoaGddGANK2MA6NR) MarshalJSON() ([]byte, error) { | ||
if o.MoebiusSchema != nil { | ||
return json.Marshal(o.MoebiusSchema) | ||
} | ||
if o.StringDoaGddGA != nil { | ||
return json.Marshal(o.StringDoaGddGA) | ||
} | ||
return nil, errors.New("failed to marshal any one of the object properties") | ||
} | ||
type MoebiusSchema struct { | ||
MoebiusProperty *MoebiusSchema `json:"MoebiusProperty,omitempty"` | ||
} | ||
MoebiusProperty *MoebiusSchema `json:"MoebiusProperty,omitempty"` | ||
DeeperMobiusProperty *OneOfMoebiusSchemaStringDoaGddGANK2MA6NR `json:"deeperMobiusProperty,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
from typing import TypedDict | ||
from typing import Optional | ||
from typing import NewType | ||
from typing import Union | ||
|
||
StringDoaGddGA = NewType("StringDoaGddGA", str) | ||
|
||
OneOfMoebiusSchemaStringDoaGddGANK2MA6NR = NewType("OneOfMoebiusSchemaStringDoaGddGANK2MA6NR", Union[MoebiusSchema, StringDoaGddGA]) | ||
|
||
class MoebiusSchema(TypedDict): | ||
MoebiusProperty: Optional[MoebiusSchema] | ||
deeperMobiusProperty: Optional[OneOfMoebiusSchemaStringDoaGddGANK2MA6NR] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
export type StringDoaGddGA = string; | ||
export type OneOfMoebiusSchemaStringDoaGddGANK2MA6NR = MoebiusSchema | StringDoaGddGA; | ||
export interface MoebiusSchema { | ||
MoebiusProperty?: MoebiusSchema; | ||
deeperMobiusProperty?: OneOfMoebiusSchemaStringDoaGddGANK2MA6NR; | ||
[k: string]: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters