Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow string values in provider.apiGateway.apiKeys #1662

Merged
merged 1 commit into from Dec 13, 2023

Conversation

andersem
Copy link
Contributor

Description

Fixes the problem where getApiKeysValues would only allow FIRST_API_KEY in the following config, and not SECOND_API_KEY because it's not an object.

provider:
  name: aws
  apiGateway:
    apiKeys:
      - name: FIRST_API_KEY_NAME
        value: FIRST_API_KEY
      - SECOND_API_KEY

Strings are supported, according to the serverless (docs)[https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#api-gateway-v1-rest-api].

Motivation and Context

  • Allows using standard serverless syntax

Fixes #1661

How Has This Been Tested?

Tested with unit tests with both types of input

Fixes the problem where `getApiKeysValues` would only allow `FIRST_API_KEY` in the following config, and not `SECOND_API_KEY` because it's not an object.

```yaml
provider:
  name: aws
  apiGateway:
    apiKeys:
      - name: FIRST_API_KEY_NAME
        value: FIRST_API_KEY
      - SECOND_API_KEY
```

Strings are supported, according to the serverless (docs)[https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#api-gateway-v1-rest-api].

Allows using standard serverless syntax

Tested with unit tests

Fixes dherault#1661
@andersem
Copy link
Contributor Author

I guess there's a use case for API_KEYs that can be empty strings?

@dnalborczyk dnalborczyk changed the title Allow string values in provider.apiGateway.apiKeys fix: Allow string values in provider.apiGateway.apiKeys Sep 20, 2023
@gangadharKorrapati
Copy link

+1 support string x-api-keys

@dnalborczyk dnalborczyk merged commit d0b7606 into dherault:master Dec 13, 2023
@dnalborczyk
Copy link
Collaborator

thank you @andersem !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API keys not detected if only strings
3 participants