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

Handle :: in conflicting Anchor type names #335

Closed
lorisleiva opened this issue Nov 28, 2024 · 0 comments · Fixed by #367
Closed

Handle :: in conflicting Anchor type names #335

lorisleiva opened this issue Nov 28, 2024 · 0 comments · Fixed by #367
Labels
bug Something isn't working

Comments

@lorisleiva
Copy link
Member

When generating an Anchor IDL that exports conflicting types, it will use the fully qualified name — e.g. some::crate::MyType — instead of the type name alone — e.g. MyType.

Since Codama only support camel-cased names, this is not compatible with the standard. The side-effect is that we have JavaScript generated imports that look like import { some::crate::MyType } from '../types'.

Two possible solutions:

  • Option A. We adjust the camelCase function so that it knows how to handle special characters like :: and concatenate the segments properly — e.g. some::crate::MyType becomes SomeCrateMyType.
  • Option B. We try and identify :: characters in the nodes-from-anchor package since this pattern should only ever happen on an IDL coming from Anchor such that it has conflicting types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant