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

Generated name is wrong for generic types with many type parameters #6392

Closed
1 task done
N-Olbert opened this issue Jul 27, 2023 · 0 comments · Fixed by #6461
Closed
1 task done

Generated name is wrong for generic types with many type parameters #6392

N-Olbert opened this issue Jul 27, 2023 · 0 comments · Fixed by #6461

Comments

@N-Olbert
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Product

Hot Chocolate

Describe the bug

When using a type with more than nine generic arguments, the generated GraphQL-name incorrectly contains a '_'.

See example.

Steps to reproduce

    public class Query
    {
        // Generated name (OK): NineGenericsOfInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32
        public NineGenerics<int, int, int, int, int, int, int, int,int> TestNine => default!;

        // Generated name (WRONG): TenGenerics_OfInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32AndInt32
        public TenGenerics<int, int, int, int, int, int, int, int,int, int> TestTen => default!;
    }


    public class NineGenerics<T1, T2, T3, T4, T5, T6, T7, T8, T9>
    {
        public int Foo { get; set; }
    }
    public class TenGenerics<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
    {
        public int Foo { get; set; }
    }

image

Relevant log output

No response

Additional Context?

I case you wonder why someone would use types with that many arguments: We use them to represent strictly typed data tables (T1 = Type of column 1, T2 = Type of column 2 etc. etc.)

Is suspect the bug to happen somewhere around here

name = name.Substring(0, name.Length - _typePostfix.Length);
(anyways, I haven't verified this)

Version

13.4.0

@michaelstaib michaelstaib added this to the HC-13.5.0 milestone Jul 28, 2023
N-Olbert added a commit to N-Olbert/graphql-platform that referenced this issue Aug 20, 2023
Determine the length of the generic type postfix delimiter instead of using a hardcoded length. Added unittest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants