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

Dictionaries not supported #161

Open
poloBBQ opened this issue Jun 25, 2018 · 1 comment
Open

Dictionaries not supported #161

poloBBQ opened this issue Jun 25, 2018 · 1 comment

Comments

@poloBBQ
Copy link

poloBBQ commented Jun 25, 2018

Expected Behavior

Dictionary properties with string keys should generate a swagger document using object-typed additionalProperties as explained in the Swagger specification.

public Dictionary<string, int> Dictionary { get; set; }

Should output something equivalent to:

"dictionary": {"type": "object","additionalProperties": {"type": "integer","format": "int32"}}

Actual Behavior

An array is generated, which is an incorrect interpretation of a dictionary. As an example:

public Dictionary<string, int> Dictionary { get; set; }

Outputs:

"dictionary": {"type": "array","items": {"type": "string"}}

Other Information:

I forked the repo and commited a change to support dictionaries, please let me know if I should create a pull request with it or do any corrections https://github.com/evicertia/Nancy.Swagger/tree/dictionary-support

Thanks.

@yahehe
Copy link
Owner

yahehe commented Oct 16, 2018

Your changes look good to me @poloBBQ ! The only thing I would ask is if you could write some tests to valid the correct functionality. Feel free to open a PR!

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

No branches or pull requests

2 participants