Skip to content

Recommenders

Rico Suter edited this page May 1, 2020 · 14 revisions

To manage the OpenAPI Endpoint recommenders go to the Project / Settings / Recommenders page and update the JSON with your own rules.

The default recommenders (if editor is empty):

[
  {
    "discriminator": "HttpSchemaNameBestPracticesRecommender"
  },
  {
    "discriminator": "HttpSchemaPropertyNameBestPracticesRecommender"
  }
]

Sample recommenders:

[
  {
    "discriminator": "HttpSchemaNameBestPracticesRecommender"
  },
  {
    "discriminator": "HttpSchemaPropertyNameBestPracticesRecommender"
  },
  {
    "name": "HttpPath.RegexMismatch",
    "title": "Invalid HTTP Path",
    "description": "Path {path} should start with `/api/v[0-9]`.",
    "regex": "^/api/v[0-9]+/.*$",
    "discriminator": "HttpPathRegexRecommender"
  },
  {
    "name": "HttpPath.RegexMismatch",
    "title": "Invalid HTTP Path",
    "description": "Path {path} segments should use lower case characters only.",
    "regex": "^(/api/v[0-9]+/)?([a-z]*|/|{.*})*$",
    "discriminator": "HttpPathRegexRecommender"
  },
  {
    "name": "HttpPath.RegexMismatch",
    "title": "Invalid HTTP Path",
    "description": "Path {path} parameters should use alpha characters only.",
    "regex": "^(/api/v[0-9]+/)?(.*|/|{[a-zA-Z]*})*$",
    "discriminator": "HttpPathRegexRecommender"
  },
  {
    "name": "HttpOperation.ParameterName.RegexMismatch",
    "title": "Invalid parameter name for date time",
    "description": "The date time parameter `{parameter}` should start with 'dateTime' or contain 'DateTime'.",
    "parameterType": "String",
    "parameterFormat": "date-time",
    "regex": "^(dateTime)|(.*DateTime.*)$",
    "discriminator": "HttpParameterNameRegexRecommender"
  },
  {
    "name": "HttpSchema.PropertyName.RegexMismatch",
    "title": "Invalid property name for date time",
    "description": "The date time property `{property}` should start with 'dateTime' or contain 'DateTime'.",
    "propertyType": "String",
    "propertyFormat": "date-time",
    "regex": "^(dateTime)|(.*DateTime.*)$",
    "discriminator": "HttpSchemaPropertyNameRegexRecommender"
  }
]

To disable all recommenders use:

[]
Clone this wiki locally