ServiceStack Swagger integration currently always marks reference type properties in the request as required (though that could possibly be changed). You may be able to use a ModelFilter
callback (specified as a property of SwaggerFeature
when you register that as a plugin) to modify the Required
property of each ModelProperty
object sent to your callback. And you can also modify the Description
of each ModelProperty with this technique, if you need additional descriptive text to mark required/optional fields.
Note that if you want to use the ApiMember attribute to annotate request body parameters, you must specify ParameterType = "body"
and Name = "(name of property)"
in the attribute. But there's not a lot you can do with this attribute for request body parameters currently; it's most useful for "query" or "path" ParameterTypes.