Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Type should not be able to extend choice type #876

Open
SimonCockx opened this issue Nov 25, 2024 · 0 comments
Open

Type should not be able to extend choice type #876

SimonCockx opened this issue Nov 25, 2024 · 0 comments
Labels
bug Something isn't working subject: syntax This issue is about the syntax of Rosetta

Comments

@SimonCockx
Copy link
Contributor

Due to the implementation strategy of choice types as a thin layer of syntactic sugar on top of complex types, a bug was introduced, allowing types to extend choice types, e.g.,

choice StringOrNumber:
  string
  number

type StringOrNumberWithAttribute extends StringOrNumber:
  attr int (1..1)

We should deprecate this behaviour and fix it.

Impact on the CDM

Unfortunately, this bug is already used as a feature in the CDM:

type BasketConstituent extends Observable:
  ...

type TransferableProduct extends Asset:
  ...

I would propose to refactor them as follows:

type BasketConstituent:
  observable Observable (1..1)
  ...

type TransferableProduct:
  asset Asset (1..1)
  ...

If BasketConstituent is considered a kind of Observable, it should be added to the list of options inside Observable:

choice Observable:
  ...
  BasketConstituent

Similarly, if TransferableProduct is considered a kind of Asset, it should be added to the list of options inside Asset:

choice Asset:
  ...
  TransferableProduct
@SimonCockx SimonCockx added bug Something isn't working subject: syntax This issue is about the syntax of Rosetta labels Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working subject: syntax This issue is about the syntax of Rosetta
Projects
None yet
Development

No branches or pull requests

1 participant