Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Schema reference occurred previously is generated as any #130

Open
ivan-klass opened this issue Jun 25, 2020 · 0 comments
Open

Schema reference occurred previously is generated as any #130

ivan-klass opened this issue Jun 25, 2020 · 0 comments

Comments

@ivan-klass
Copy link

When schema field is occurred next time, it is referenced with it's full name.
avro-to-typescript is unable to generate such cases, example:

{
  "type": "record",
  "name": "Bug",
  "namespace": "reuse.failure",
  "fields": [
    {
      "name": "firstOccurrence",
      "type": {
        "type": "record",
        "namespace": "reuse.failure",
        "name": "Occurrence",
        "fields": [
          {
            "name": "value",
            "type": "string"
          }
        ]
      }
    },
    {
      "name": "secondOccurrence",
      "type": "reuse.failure.Occurrence"
    }
  ]
}

generates

export interface Occurrence {
    value: string;
}

export interface BugInterface {
    firstOccurrence: Occurrence;
    secondOccurrence: any;
}

export class Bug extends BaseAvroRecord implements BugInterface {
// ...
    public firstOccurrence!: Occurrence;
    public secondOccurrence!: any;
// ...
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant