Skip to content

String primary key returns wrong Swagger links #265

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

Closed
bdebaere opened this issue Mar 14, 2018 · 1 comment
Closed

String primary key returns wrong Swagger links #265

bdebaere opened this issue Mar 14, 2018 · 1 comment
Assignees

Comments

@bdebaere
Copy link

bdebaere commented Mar 14, 2018

If you take the example code of the SwaggerODataWebApiSample project and you change the Person entity to have a string primary key. Then the links provided by Swagger no longer make sense. Next to the GET, in the Curl and in the request URL. The POST is also wrong and I would assume the PUT to be the same. See the screenshot provided below.

namespace Microsoft.Examples.Models
{
    using System;
    using System.ComponentModel.DataAnnotations;

    /// <summary>
    /// Represents a person.
    /// </summary>
    public class Person
    {
        /// <summary>
        /// Gets or sets the unique identifier for a person.
        /// </summary>
        /// <value>The person's unique identifier.</value>
        public string Id { get; set; }

        /// <summary>
        /// Gets or sets the first name of a person.
        /// </summary>
        /// <value>The person's first name.</value>
        [Required]
        [StringLength( 25 )]
        public string FirstName { get; set; }

        /// <summary>
        /// Gets or sets the last name of a person.
        /// </summary>
        /// <value>The person's last name.</value>
        [Required]
        [StringLength( 25 )]
        public string LastName { get; set; }

        /// <summary>
        /// Gets or sets the email address for a person.
        /// </summary>
        /// <value>The person's email address.</value>
        public string Email { get; set; }

        /// <summary>
        /// Gets or sets the telephone number for a person.
        /// </summary>
        /// <value>The person's telephone number.</value>
        public string Phone { get; set; }
    }
}

image

@bdebaere bdebaere changed the title String primary key returns wrong Swagger link String primary key returns wrong Swagger links Mar 14, 2018
@commonsensesoftware commonsensesoftware self-assigned this Mar 14, 2018
@commonsensesoftware
Copy link
Collaborator

Weird. Not sure when or how that happened. I'm just going to assume it's a bug. I'll take a look and publish a fix as soon as I can. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants