Issues with v4.5.11

Thanks, that’s point me how this can be avoided. Swagger UI has this code which should fill up schema.required when property of the schema is marked as required.

  swagger.definitions = swagger.definitions || {};
  for(name in obj) {
    var existingModel = obj[name];
    var _required = [];
    var schema = { properties: {}};
    var propertyName;
    for(propertyName in existingModel.properties) {
      var existingProperty = existingModel.properties[propertyName];
      var property = {};
      this.dataType(existingProperty, property);
      if(existingProperty.description) {
        property.description = existingProperty.description;
      }
      if(existingProperty['enum']) {
        property['enum'] = existingProperty['enum'];
      }
      if(typeof existingProperty.required === 'boolean' && existingProperty.required === true) {
        _required.push(propertyName);
      }
      if(typeof existingProperty.required === 'string' && existingProperty.required === 'true') {
        _required.push(propertyName);
      }
      schema.properties[propertyName] = property;
    }

    if(_required.length > 0) {
      schema.required = _required;
    } else {
      schema.required = existingModel.required;
    }
    swagger.definitions[name] = schema;
  }
};

But looks like this code does not work or works wrong. I’ve changed ServiceStack.Api.OpenApi code and added pushing required properties to the Required array of the schema in this commit and Swagger UI now adds required class in HTML when showing model properties.

However Swagger UI does not add visually anything for the required properties but at least it does not show that these properties are optional as it was previously.

You also can override default Swagger UI required style by adding *.css and index.html files to the root of the /swagger-ui path as it documented here to show your own custom visualization for required property

This change is available on MyGet from v4.5.13

Great! Glad you guys were able to resolve both issues so quickly!