0

For some reason my Array/List properties of Request DTOs don't show up as such, but as Data Type 'string'

When I use ApiMembers like this:

    [ApiMember]
    public int[] BlogIds { get; set; }

The will show up as 'string' in the Swagger.io for ServiceStack list of parameters with the following attributes:

Parameter Type: Query
Data Type: string

Swagger UI

It does work for the Response schema, where is shows the JSON as:

"BlogIds": [
"int"
],

1 Answer 1

0

It needs to be sent as a string on the QueryString.

ServiceStack allows you to send complex objects on the QueryString using the JSV Format which Swagger doesn't understand.

But it does let you send a comma-delimited string:

BlogIds 1,2,3

You can also choose be more explicit by including the [] brackets, e.g:

BlogIds [1,2,3]
Sign up to request clarification or add additional context in comments.

2 Comments

Just found that out myself, but you were quicker! Would it be possible to the YAML / a Swagger Editor compatible format to make that visible to the consumers of the service?
@Gabriël Can't support multiple queryString parsing formats so it would need to be configurable, but no-one has requested it yet so wouldn't be a great feature to support competing strategies if the non-default will never get used, just adds unnecessary complexity in code-base + docs. TBH We're more likely to add an alternative to Swagger UI, something more optimized which we have complete control of.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.