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

Adding a ObjectGraphType for a ContentPart that has ContentField(s) causes a "field already added" exception #6253

Closed
kadamgreene opened this issue May 23, 2020 · 1 comment · Fixed by #16151

Comments

@kadamgreene
Copy link

I created a ContentPart and added 2 DateTimeFields to it. Because it has other, non-field properties, I created a ObjectGraphType<SchedulePart>. But during the building of the Schema, it first adds my ObjectGraphType (via TypedContentTypeBuilder) and names it schedule (via ToFieldName extension method). But every place where it checks to see if a field already exists, it does this:

if (contentItemType.HasField(partName)) continue;

which will look for SchedulePart not schedule. This especially happens in DynamicContentTypeBuilder where the exception happens.

I think the code should be:

if (contentItemType.HasField(partName.ToFieldName())) continue;

Wherever it is doing the check for existing fields.

@jtkech
Copy link
Member

jtkech commented May 24, 2020

Looks good, could you open a new PR to fix it so that a graphQL expert can review it

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.

5 participants