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

GetIndexRequest fails on dynamic_templates serialization #7221

Closed
Mpdreamz opened this issue Jan 31, 2023 · 1 comment · Fixed by #7244
Closed

GetIndexRequest fails on dynamic_templates serialization #7221

Mpdreamz opened this issue Jan 31, 2023 · 1 comment · Fixed by #7244
Labels
8.x Relates to 8.x client version
Milestone

Comments

@Mpdreamz
Copy link
Member

The converter 'Elastic.Clients.Elasticsearch.Serialization.UnionConverter+UnionConverterInner`2[System.Collections.Generic.IDictionary`2[System.String,Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate],System.Collections.Generic.ICollection`1[System.Collections.Generic.IDictionary`2[System.String,Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate]]]' read too much or not enough. Path: $['catalog-data-2023.01.31'].mappings.dynamic_templates | LineNumber: 4 | BytePositionInLine: 29.

This happens when I do a GetIndexRequest that returns the following json:

https://gist.github.com/Mpdreamz/ab38378c8be875b1821ee227febe72f1

@Mpdreamz Mpdreamz added bug 8.x Relates to 8.x client version labels Jan 31, 2023
@stevejgordon stevejgordon added this to the 8.0.6 milestone Feb 6, 2023
@stevejgordon
Copy link
Contributor

stevejgordon commented Feb 6, 2023

Thanks for raising this @Mpdreamz. I see the cause, which is missing implementation in the union converter. After fixing that, I've noticed some other issues deserializing this example response, which I will take care of.

  • The DynamicTemplates property on the TypeMapping should ideally be typed as an ICollection<IDictionary<string, Elastic.Clients.Elasticsearch.Mapping.DynamicTemplate> rather than a union here. The code generator logic to simplify such properties seems to miss this one. For usability, it's worth considering the breaking change to improve this. If implemented, the property will need to be marked to use the ICollectionSingleOrManyConverter.
  • TheDynamicTemplate.Mapping property is generated as Elastic.Clients.Elasticsearch.Mapping.Properties? but should be IProperty?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to 8.x client version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants