hyperweb-io / hyperweb-io/ts-codegen
Supports untagged enum
- Langage dominant
- TypeScript
- Étoiles
- 126
- Forks
- 31
- Merge moyen
- 19 min
- PR mergées (30 j)
- 2
Description
Current ts-codegen can't generate code from the following schema
```
{
...
"execute": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"anyOf": [
{
"$ref": "#/definitions/ExecuteMsg_for_Nullable_Empty_and_Empty"
},
{
"$ref": "#/definitions/ICNSNameExecuteMsg"
}
],
"definitions": { ... },
...
}
```
as it tries to find properties under value of "execute" but it couldn't find one.
This schema is generated from
```rs
#[cw_serde]
#[serde(untagged)]
pub enum ExecuteMsg {
CW721Base(cw721_base::ExecuteMsg),
ICNSName(ICNSNameExecuteMsg),
}
```
It fails as it tries to find `Object.keys` on execute's `properties` but it couldn't find one on [this line of code](https://github.com/CosmWasm/ts-codegen/blob/cffa2acebb86f3c1f96fb00c4abae5ba0987e63e/packages/wasm-ast-types/src/client/client.ts#L266)
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
The failure is in packages/wasm-ast-types/src/client/client.ts at line 266, where the generated schema's execute value lacks properties. Start by tracing how that code handles anyOf and the referenced definitions in the supplied draft-07 schema. Done means ts-codegen can generate code for the shown serde(untagged) ExecuteMsg without attempting Object.keys on missing properties.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust, typescript
- Domaine
- tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100