-
Notifications
You must be signed in to change notification settings - Fork 128
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
bundle command resolves refs from external files to a component name using underscore as separator #1285
Comments
Thanks for reporting! I'm not certain how to name such an option though. |
Maybe it makes sense to also name it |
@lornajane I agree, except we might need another separator for something else in the context of bundling. And since bundling is used in the |
I think |
I have the exact same problem when uploading the joined OpenAPI spec file to AWS API Gateway. The possibility to have a custom separator is really appreciated. I'm OK with naming the parameter as |
Where is it used? Could we use |
I would use it with |
it may be better to ask AWS to relax this constraint. Adding a customization for an adjacent service could be a slippery slope. |
I agree with @jeremyfiel but still I don't mind adding some generic option. The name for the option is a tricky part though. I think that the My suggestion would be |
Related (but not actually fixing the problem): a good description of the rules that AWS gateway expects: stoplightio/spectral#475 |
In the case where components with the same key are imported (referred) from different files, then the filename is prefixed to the object key (to avoid collision) but the prefix is separated with a
_
.Describe the bug
When bundling swagger with complex references, referring to objects keyed with the same key from external files using the
../filename.yml#/objectKey
syntax, the bundled swagger creates component keys for the objects using a syntax likefilename_objectKey
which then introduces an invalid (for aws api gateway) underscore character_
. You will see errors in aws such asUnable to create model for 'filename_objectKey': Model name must be alphanumeric: filename_objectKey
Fairly sure this is the offending line
redocly-cli/packages/core/src/bundle.ts
Line 392 in eb82725
To Reproduce
Steps to reproduce the behavior:
Given a swagger file and a couple of schema files
swagger.yaml
schemas/foo.yaml
schemas/bar.yaml
Running
npx redocly bundle swagger.yaml -o swagger-bundled.yaml
yeildsswagger-bundled.yaml
Note the component at
components.schemas.bar_v1
Suggestion: allow customisation/inhibition of the separator character, to avoid fouling aws alphanumeric rule or other downstream validations. Similar to the customisation of the separation character in the
split
command.The text was updated successfully, but these errors were encountered: