Azure / azure-openapi-validator

Azure Open API Validator
MIT License
47 stars 46 forks source link

Add validation rule for cognitive service's authentication pattern #128

Open alvadb opened 6 years ago

alvadb commented 6 years ago

Cognitive services have settled on an authentication approach that should be present in all their swaggers. It would be ideal if this could be applied to only cognitive services swaggers. Depends on issue #127.

lmazuel commented 6 years ago

Details: All Swaggers must have this declaration:

  "securityDefinitions": {
    "apim_key": {
      "type": "apiKey",
      "name": "Ocp-Apim-Subscription-Key",
      "in": "header"
    }
  },
  "security": [
    {
      "apim_key": []
    }
  ],

Key here is apim_key. Could be something else, this is not enforced right now since Autorest does not use it anyway (you'll see some Swaggers using apiKeyHeader)

They must NOT declare any headers parameters with the value Ocp-Apim-Subscription-Key