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

feat(types): build uniontypes too #765

Merged
merged 3 commits into from
Nov 24, 2023
Merged

feat(types): build uniontypes too #765

merged 3 commits into from
Nov 24, 2023

Conversation

mttrbrts
Copy link
Member

@mttrbrts mttrbrts commented Nov 24, 2023

Modifies the build step to also build an alternative set of Typescript type definitions that use static union types for field declarations where type inheritance is used.

Changes

  • Uses the new flattenSubclassesToUnion on the TypeScript codegen visitor
  • Exposes the types in two new root exports:
import { concertoMetamodelWithUnions, concertoWithUnions } from '@accordproject/concerto-types';

const position: concertoMetamodelWithUnions.IPosition = { 
//...
};

Flags

  • Note that because this is a static build step, users of the new types will not be able to validate against custom extensions to the base types in client-code. However, the impact is muted here, because client extensions to the metamodel are not encouraged.

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@mttrbrts mttrbrts requested a review from a team November 24, 2023 11:10
Copy link
Contributor

@dselman dselman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job with the e2e test.

@dselman
Copy link
Contributor

dselman commented Nov 24, 2023

Need to exclude generated code from license check:

No default format specified using {"prepend":"/*","append":"*/"} as backup
✗ License not found in  /home/runner/work/concerto/concerto/packages/concerto-types/src/concerto.metamodel.test.ts
✗ License not found in  /home/runner/work/concerto/concerto/packages/concerto-types/src/generated/unions/[email protected]
✗ License not found in  /home/runner/work/concerto/concerto/packages/concerto-types/src/generated/unions/concerto.ts
✗ License not found in  /home/runner/work/concerto/concerto/packages/concerto-types/src/generated/unions/[email protected]

@mttrbrts mttrbrts marked this pull request as ready for review November 24, 2023 13:26
@mttrbrts mttrbrts merged commit fc35a40 into main Nov 24, 2023
@mttrbrts mttrbrts deleted the mr-union-types branch November 24, 2023 13:26
mttrbrts added a commit to mttrbrts/composer-concerto that referenced this pull request Mar 10, 2024
* feat(types): build uniontypes too

Signed-off-by: Matt Roberts <[email protected]>

* fix(build): include unions in index

Signed-off-by: Matt Roberts <[email protected]>

* chore(deps): upgrade codegen to latest release

Signed-off-by: Matt Roberts <[email protected]>

---------

Signed-off-by: Matt Roberts <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants