Skip to content
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

Swashbuckle support #286

Closed
bugproof opened this issue May 18, 2018 · 2 comments
Closed

Swashbuckle support #286

bugproof opened this issue May 18, 2018 · 2 comments
Labels

Comments

@bugproof
Copy link

bugproof commented May 18, 2018

Example:

public class Person : Identifiable
{
    public ICollection<PersonInfo> PersonInfos { get; set; }
}

What I want to use for input and output of my API:

public class Person
{
    public PersonInfo PersonInfo { get; set; }
}

Even though public ICollection<PersonInfo> PersonInfos { get; set; } is not marked with Attr my swagger spec generated from swashbuckle expects me to pass array of infos.

Example POST:
image

Ideally my model should look like:

public class Person : Identifiable
{
    public ICollection<PersonInfo> PersonInfos { get; set; }
    [Attr("info"), NotMapped]
    public PersonInfo PersonInfo { get; set; }
}

Will JADNC ignore this array anyway? Means it is only visible like that because of Swashbuckle and I can resolve this with custom filter for swashbuckle, or it's a fault of the library?

@jaredcnance
Copy link
Contributor

jaredcnance commented Jun 5, 2018

JADNC will not perform operations on any properties that do not have the Attr or relationship attributes. You may need to explicitly tell Swashbuckle that this property is not exposed via the API. However, looking at the screenshot you probably have more issues since the content-type and document don't look like json:api. I haven't spent much time trying to get this to work with Swashbuckle, but I know we have a few users who have solved this. As time opens up, I do intend providing better support out-of-the-box or at minimum a step-by-step guide to getting Swagger running.

@bugproof bugproof changed the title Data transfer objects, mismatch between models Swashbuckle support Jun 5, 2018
@jaredcnance
Copy link
Contributor

Closing. Work is being tracked by #259. Feel free to reopen if this is insufficient.

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

No branches or pull requests

2 participants