Skip to content

CSharp code generator - property names changed to fit language convention #727

Closed
@boazsapir

Description

@boazsapir

I have a property name in my schema which is lower-case, e.g.:

*@swg\Definition(definition="TimeIntput", type="object",
* required={ "time" },
* @swg\Property(property="time", type="integer", description="timestamp"),
* )

This property should be included as part of a request body:

*   @SWG\Parameter(name="Input", in="body", @SWG\Schema(ref="#/definitions/TimeInput")),

The CSharp code generator creates a class where the property name is capitalized according to the language conventions:
namespace io.swagger.Model {
public class TimeInput {

/* timestamp */

public int? Time { get; set; }

public override string ToString()  {
  var sb = new StringBuilder();
  sb.Append("class TimeInput {\n");

  sb.Append("  Time: ").Append(Time).Append("\n");

  sb.Append("}\n");
  return sb.ToString();
}

}

When sending the request by APIInvoker, the CSharp object which is an instance of the above class is serialized so the parameter in the request body has the capitalized name.
This means that the server does not get the parameter with the expected name as defined in the schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions