-
Notifications
You must be signed in to change notification settings - Fork 221
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
Model FieldDeserializers key is always first letter lowercase - CSharp #1830
Comments
Hi @MarkusBux The code lives here for deserialization.
And there for serialization
(and we have equivalents for other languages) Is this something you'd be willing to submit a pull request for? |
Hi @baywet thanks for pointing to the corresponding lines within the code. I will try to create a PR, but I think there may arise another issue. components:
schemas:
todo:
title: Todo
type: object
properties:
id:
type: string
subject:
type: string
Subject:
type: string Using this definition will create a model like public class Todo : IAdditionalDataHolder, IParsable {
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>The id property</summary>
public string Id { get; set; }
/// <summary>The subject property</summary>
public string Subject { get; set; }
/// <summary>
/// Instantiates a new todo and sets the default values.
/// </summary>
public Todo() {
AdditionalData = new Dictionary<string, object>();
}
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
/// </summary>
public static Todo CreateFromDiscriminatorValue(IParseNode parseNode) {
_ = parseNode ?? throw new ArgumentNullException(nameof(parseNode));
return new Todo();
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
public IDictionary<string, Action<IParseNode>> GetFieldDeserializers() {
return new Dictionary<string, Action<IParseNode>> {
{"id", n => { Id = n.GetStringValue(); } },
{"subject", n => { Subject = n.GetStringValue(); } },
};
}
/// <summary>
/// Serializes information the current object
/// <param name="writer">Serialization writer to use to serialize this model</param>
/// </summary>
public void Serialize(ISerializationWriter writer) {
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteStringValue("id", Id);
writer.WriteStringValue("subject", Subject);
writer.WriteAdditionalData(AdditionalData);
}
} As you can see, there is only one property on the model for |
I'm currently playing around with kiota and have the problem that the models generated field deserializer dictionary writes the properties always with first letter in lowercase.
In case the API send uppercase property names, it does not match and therefore the properties of the model are not populated.
Is there a way to do the match case-insensitive or is there a configuration available to do not lower-case the first letter while creating the model?
API response
The text was updated successfully, but these errors were encountered: