You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fails: Error: [InvalidResourceException('DebugApi', "The OpenApiVersion value must be of the format '3.0.0'.")] ('DebugApi', "The OpenApiVersion value must be of the format '3.0.0'.")
Expected result:
Should work.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Waiting for changeset to be created..
Error: Failed to create changeset for the stack: TL-DEBUG, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [DebugApi] is invalid. The OpenApiVersion value must be of the format '3.0.0'.
What is your use case here, where you need dynamic value of Open API version?
i just want to generate configs using Parameters. I define the solid base in the parameters and just use a template with !Ref to apply the values, instead of manually changing the numbers.
@nikitasius This comes down to how/where intrinsics are resolved. CloudFormation does not resolve intrinsics before calling SAM (or any CloudFormation Macro), so SAM has to re-implement behavior. We don't have a consistency here and tend to try not to resolve things, so we don't have to handle re-implementing resolving.
So yes, your string passes the regex but SAM actually gets the Ref: OpenApiVersionParam instead of the value 3.0.3.
Is there any reason you want to define this in a parameter? Usually they are for things that change often, which I assume this does not? Maybe I am missing some other use case that make this value. I only ask because of the above comment on where intrinsics get resolved, it would be nice if CloudFormation would just do a pass before calling SAM but that is a complete aside here.
Is there any reason you want to define this in a parameter? Usually they are for things that change often, which I assume this does not?
@j0lly to be honest i don't want to create philosophic discussions to be or not to be, etc. As i told before, i build a parameter set and use it.
SAM and/or Cloudformation do the things wrong. Thats all, this !Ref doesn't work.
@nikitasius It helps us understand the use-case and the why. I understand the view point of just make this work but there are reasons (as described above) it doesn't work today.
With that, this is a feature request to add Ref support and the way you will need to do this today is by providing inline and not using intrinsic functions.
With that, this is a feature request to add Ref support and the way you will need to do this today is by providing inline and not using intrinsic functions.
thanks. Yep i provide it as is w/o !Ref have no choice :)
Activity
jfuss commentedon Apr 13, 2022
@nikitasius Does this only happen locally?
nikitasius commentedon Apr 13, 2022
hi, just tested, nope:
nikitasius commentedon Apr 13, 2022
i.e.
3.0.0,3.0.3- same error when i pass is as a variable.mndeveci commentedon Apr 14, 2022
Looking at the code, SAM only validates against constant values therefore intrinsics are not supported for this field. See;
https://github.com/aws/serverless-application-model/blob/develop/samtranslator/model/api/api_generator.py#L265
serverless-application-model/samtranslator/swagger/swagger.py
Line 1364 in e4ffc6e
What is your use case here, where you need dynamic value of Open API version?
Thanks!
nikitasius commentedon Apr 14, 2022
i just want to generate configs using
Parameters. I define the solid base in the parameters and just use a template with !Ref to apply the values, instead of manually changing the numbers.btw, 3.0.3 or 3.0.0 passing fine the regex

Well, guess in this case it's a bug in SAM tool. Becase you allow to use "sam's unique only" features but you don't properly filter the configs.
jfuss commentedon Apr 14, 2022
@nikitasius This comes down to how/where intrinsics are resolved. CloudFormation does not resolve intrinsics before calling SAM (or any CloudFormation Macro), so SAM has to re-implement behavior. We don't have a consistency here and tend to try not to resolve things, so we don't have to handle re-implementing resolving.
So yes, your string passes the regex but SAM actually gets the
Ref: OpenApiVersionParaminstead of the value3.0.3.Is there any reason you want to define this in a parameter? Usually they are for things that change often, which I assume this does not? Maybe I am missing some other use case that make this value. I only ask because of the above comment on where intrinsics get resolved, it would be nice if CloudFormation would just do a pass before calling SAM but that is a complete aside here.
nikitasius commentedon Apr 14, 2022
@j0lly to be honest i don't want to create philosophic discussions to be or not to be, etc. As i told before, i build a parameter set and use it.
SAM and/or Cloudformation do the things wrong. Thats all, this
!Refdoesn't work.jfuss commentedon Apr 14, 2022
@nikitasius It helps us understand the use-case and the why. I understand the view point of just make this work but there are reasons (as described above) it doesn't work today.
With that, this is a feature request to add Ref support and the way you will need to do this today is by providing inline and not using intrinsic functions.
[-]OpenApiVersion: !Ref OpenApiVersionParam fails[/-][+]Support Ref in OpenApiVersion[/+]nikitasius commentedon Apr 15, 2022
thanks. Yep i provide it as is w/o !Ref have no choice :)
hoffa commentedon Oct 12, 2022
Can you try adding
AWS::LanguageExtensionsto youTransforms? (see #2533)This works:
hoffa commentedon Nov 3, 2022
Closing in favor of #2533.