I have the following path and model defined using editor.swagger.io (V2.0):

   
 swagger: '2.0'
    info:
      version: V1
      title: x
      description: x
      termsOfService: x
      contact:
        name: x
        email: x
      license:
        name: x
        url: 'x'
    
    paths:
      '/api/v1/consumer/profile':
        get:
          security:
            - Bearer: []
          tags:
            - consumer
          summary: Gets a consumer profile
          description: Retrieves a users profile
          operationId: getConsumerProfileById
          produces:
            - application/json
            - application/xml
    
          responses:
            '200':
              description: Retrieved Consumer Profile
              schema:
                $ref: '#/definitions/consumer'
            '401':
              description: Unauthorized


    definitions:
      consumer:
        properties:
          firstName:
            type: string
          lastName:
            type: string
          gender:
            type: string
          dateOfBirth:
            type: string
            format: date
          profilePicUrl:
            type: string
            format: uri
          location:
            allOf:
              - $ref: "#/definitions/location"
              - type: object
          contactInfo:
            allOf:
              - $ref: "#/definitions/contactInfo"
              - type: object


      contactInfo:
        type: object
        properties:
          mobile:
            type: string
          landline:
            type: string
          email:
            type: string
          website:
            type: string
            format: url


      location:
        properties:
          address:
            allOf:
              - $ref: "#/definitions/address"
              - type: object
          gps:
            allOf:
              - $ref: "#/definitions/gps"
              - type: object


      gps:
        properties:  
          latitude:
            type: string
            format: gps_decimal_degrees
          longitude:
            type: string
            format: gps_decimal_degrees


      address:
        properties:
          addressOne:
            type: string
          addressTwo:
            type: string
          addressThree:
            type: string
          postcode:
            type: string
          city:
            type: string
          county:
            type: string
          country:
            type: string




This results in JSON which looks like this:






    {
      "firstName": "string",
      "lastName": "string",
      "gender": "string",
      "dateOfBirth": "string",
      "profilePicUrl": "string",
      "location": {
        "address": {
          "addressOne": "string",
          "addressTwo": "string",
          "addressThree": "string",
          "postcode": "string",
          "city": "string",
          "county": "string",
          "country": "string"
        },
        "gps": {
          "latitude": "string",
          "longitude": "string"
        }
      },
      "contactInfo": {
        "mobile": "string",
        "landline": "string",
        "email": "string",
        "website": "string"
      }
    }



The problem is, when I try to Generate an aspnetcore server stub for it, 
the model comes out incorrect:

   
 using System;
    using System.Text;
    using System.Runtime.Serialization;
    using Newtonsoft.Json;
    
    namespace IO.Swagger.Models
    {
        /// <summary>
        /// 
        /// </summary>
        [DataContract]
        public partial class Consumer : IEquatable<Consumer>
        { 
            /// <summary>
            /// Gets or Sets FirstName
            /// </summary>
            [DataMember(Name="firstName")]
            public string FirstName { get; set; }
    
            /// <summary>
            /// Gets or Sets LastName
            /// </summary>
            [DataMember(Name="lastName")]
            public string LastName { get; set; }
    
            /// <summary>
            /// Gets or Sets Gender
            /// </summary>
            [DataMember(Name="gender")]
            public string Gender { get; set; }
    
            /// <summary>
            /// Gets or Sets DateOfBirth
            /// </summary>
            [DataMember(Name="dateOfBirth")]
            public DateTime? DateOfBirth { get; set; }
    
            /// <summary>
            /// Gets or Sets ProfilePicUrl
            /// </summary>
            [DataMember(Name="profilePicUrl")]
            public string ProfilePicUrl { get; set; }
    
            /// <summary>
            /// Returns the string presentation of the object
            /// </summary>
            /// <returns>String presentation of the object</returns>
            public override string ToString()
            {
                var sb = new StringBuilder();
                sb.Append("class Consumer {\n");
                sb.Append("  FirstName: ").Append(FirstName).Append("\n");
                sb.Append("  LastName: ").Append(LastName).Append("\n");
                sb.Append("  Gender: ").Append(Gender).Append("\n");
                sb.Append("  DateOfBirth: ").Append(DateOfBirth).Append("\n"
);
                sb.Append("  ProfilePicUrl: ").Append(ProfilePicUrl).Append(
"\n");
                sb.Append("}\n");
                return sb.ToString();
            }
        }


Is this a bug or am I missing something in my definition?

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to