Skip to main content

required-api-key-authorization-key-name

Overview

This rule belongs to the swagger-v1-validation ruleset and states that:

If the authorization type is API Key (i.e. type is set to apiKey), the Authorization Object must specify a name for the API Key parameter, using the keyname property. If a name is not provided, apiKey will be assumed by default automatically during import/transformations into APIMatic.

PropertyValue
EnabledYes
Maximum SeverityError
MessageRequired property keyname in API key Authorization Object is missing.
CodeSWAGGER1_V403
TypeValidation
Rule SystemSemantic
Broad CategoryAuthorizations
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsswagger1 swagger semantic validation keyname api key type authorization

Suggested Fixes

  • Add missing keyname property in the Authorization Object.
  • Make sure that the keyname property is not null or empty.
  • Ensure that the name you provide as keyname matches exactly with one expected to be sent for the API key when authorizing an API request.
  • Choose a different authorization type if API key name is not applicable in your API authentication's case.

For More Information