Open poloBBQ opened 6 years ago
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"}}
An array is generated, which is an incorrect interpretation of a dictionary. As an example:
Outputs:
"dictionary": {"type": "array","items": {"type": "string"}}
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.
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!
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.