-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
config with api keys with provided values and multiple usage plans fails #9440
Comments
Hello @iPherian, thanks a lot for reporting and sorry you've run into trouble. I've managed to reproduce your use case and I believe that the underlying logic is correct, however, the schema does not accept object-based configuration for the keys when multiple usage plans are involved - it will need to be adjusted here: serverless/lib/plugins/aws/provider.js Lines 272 to 298 in ec90945
We'd be more than happy to accept a PR with the change implementing it. 🙌 |
@pgrzesik would a schema block using |
Hey @prithvijit-dasgupta - could you propose how that could look like? I'm not sure about |
@pgrzesik
would translate to essentially to this JSON
Assuming Using JSON Schema 7.0 patternProperties, the schema would end up something like
However, I am not sure if the internal processing takes care of the example structure. I could have misunderstood the example and the use case |
Hey @prithvijit-dasgupta - yeah, something along those lines should work just fine 👍 Feel free to propose a PR if you're interested 🙌 |
Hmm that has got me thinking. Wouldn't something like this be better? This way one avoids repeating the definition of the api key object, plus you retain the previous behavior of how usage plan objects should have one property of an array to differentiate them from objects directly describing an individual api key. So like this: awsApiGatewayApiKey: {
anyOf: [
{ type: "string" },
{
type: "object",
properties: {
name: { type: "string" },
value: { type: "string" },
description: { type: "string" },
customerId: { type: "string" },
},
anyOf: [{ required: ["name"] }, { required: ["value"] }],
additionalProperties: false,
},
],
},
awsApiGatewayApiKeys: {
type: "array",
items: {
anyOf: [
{ $ref: "#/definitions/awsApiGatewayApiKey" },
{
type: "object",
maxProperties: 1,
additionalProperties: {
type: "array",
items: { $ref: "#/definitions/awsApiGatewayApiKey" },
},
},
],
},
}, |
Looks like we've got a nice PR, and it's got tests too. PR #9489 |
Yup, looks like the changes implemented in #9489 should adress this issue - I'm going to close this one, it will be a part of an upcoming release which will go out in a few days |
Serverless.yml with api keys with provided values and multiple usage plans fails.
serverless.yml
./node_modules/.bin/serverless deploy --stage apiKeysConfigBug
outputInstalled version
The text was updated successfully, but these errors were encountered: