Skip to content

fix(graphql): generate valid GraphQL for empty enums - #273

Open
Garv978 wants to merge 1 commit into
accordproject:mainfrom
Garv978:garv/248/graphql-verification
Open

fix(graphql): generate valid GraphQL for empty enums#273
Garv978 wants to merge 1 commit into
accordproject:mainfrom
Garv978:garv/248/graphql-verification

Conversation

@Garv978

@Garv978 Garv978 commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Fixes #248.

Generated GraphQL SDL could be invalid when processing Concerto models.

Changes

  • Generate a valid placeholder enum value for empty enums.
  • Generate GraphQL scalar declarations for Concerto scalar declarations.
  • Map Concept to the GraphQL JSON scalar.
  • Use GraphQL type conversion consistently for map key/value types.
  • Remove the GraphQL verification skips now that the generated SDL passes buildSchema.
  • Update the GraphQL snapshots.

Verification

  • npm test
  • npx mocha test/codegen/codegen.js
  • npx mocha test/verification
  • Direct graphql.parse() validation
  • Direct graphql.buildSchema() validation for hr_base.cto + hr.cto

All relevant GraphQL tests pass.

@apoorv7g apoorv7g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add some more documentation, Looks good to me, I have tested this and it works. Thank you for your contribution @Garv978

@mttrbrts Can you have a look later, approving from my end.

case 'Double':
return 'Float';
case 'Concept':
return 'JSON';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you explain this change? Concept should generated as the named types. This function is typically used just for scalar / primitive types.

@apoorv7g

Copy link
Copy Markdown
Contributor

Please remove unused var and trailing spaces @Garv978 Always use npm run test and not just npm run test:verify as the former contains the test suite for the whole repo

@Garv978

Garv978 commented Aug 29, 2026

Copy link
Copy Markdown
Author

its festival time so i am busy give me a day or two please

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.

bug: GraphQL verification bugs (generated output fails graphql-js)

3 participants