Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2447
Closed
Open
Issue created Mar 19, 2019 by Administrator@rootContributor

[BUG][C#] Generated code documentation does not match the JSON

Created by: albator1932

Hi guys,

I've got an issue I didn't have with the swagger-codegen (or even earlier versions of openapi-generator but I can't be sure about the version though), I have models that inherit from an abstract class that contains (among other things) a complex object, here is the corresponding JSON extract (which is valid I believe) :

  "definitions": {
    "Error": {
      "description": "Contains all the information related to an error which has occured.",
      "type": "object",
      "properties": {
        "resultcode": {
          "description": "Specifies the last result status provided by the API.",
          "enum": [
            "OK",            
            ...            
            "InvalidAPIKey"
          ],
          "type": "string",
          "readOnly": true
        },
        "extResultStatus": {
          "description": "Specifies a result code related to an error which occured in an external component.",
          "type": "string",
          "readOnly": true
        },
        "extResultMessage": {
          "description": "Specifies a message which further describes the error.",
          "type": "string",
          "readOnly": true
        },
        "internalErrorId": {
          "description": "Specifies a unique identifier, allowing to easily assess the error.",
          "type": "string",
          "readOnly": true
        }
      }
    },    
    ...
    "ActionResponse": {
      "description": "Represents the response to the action request.",
      "type": "object",
      "properties": {
        "Error": {
          "$ref": "#/definitions/Error",
          "description": "If not null, provides information about an unsuccessful action."
        },
        "RemainingTokens": {
          "format": "int64",
          "description": "Specifies the number of remaining tokens.",
          "type": "integer"
        },
        "Data": {
          "format": "byte",
          "description": "Specifies the data.",
          "type": "string",
          "readOnly": true
        }
      }
    }
  }

And now here is the corresponding generated C# (using the csharp generator with the latest snapshot from today, March 19th, default options). First the ActionResponse class:

/// <summary>
/// Initializes a new instance of the <see cref="ActionResponse" /> class.
/// </summary>
/// <param name="error">error.</param>
/// <param name="remainingTokens">Specifies the number of remaining tokens..</param>
public ActionResponse(Error error = default(Error), long? remainingTokens = default(long?))
{
    this.Error = error;
    this.RemainingTokens = remainingTokens;
}

/// <summary>
/// Gets or Sets Error
/// </summary>
[DataMember(Name="Error", EmitDefaultValue=false)]
public Error Error { get; set; }

/// <summary>
/// Specifies the number of remaining tokens.
/// </summary>
/// <value>Specifies the number of remaining tokens.</value>
[DataMember(Name="RemainingTokens", EmitDefaultValue=false)]
public long? RemainingTokens { get; set; }

/// <summary>
/// Specifies the data of the saved document.
/// </summary>
/// <value>Specifies the data of the saved document.</value>
[DataMember(Name="Data", EmitDefaultValue=false)]
public byte[] Data { get; private set; }       

even though the Error class itself is properly documented in the Error.cs

/// <summary>
/// Contains all the information related to an error which has occurred.
/// </summary>
[DataContract]
public partial class Error : IEquatable<Error>, IValidatableObject
{
}

Previously, the Error member of the ActionResponse would have the same documentation as the Error definition, i.e. <summary>Contains all the information related to an error which has occurred.</summary> instead of summary>Gets or Sets Error</summary> Of course this is only an example to illustrate the issue, the API is much larger and complex so we find this problem in many other places but hopefully you get the idea.

Any idea what has changed and could have caused this?

Assignee
Assign to
Time tracking