autorest
autorest copied to clipboard
`remove-parameter` doesn't work on `$ref`'d parameters
For common parameters, it's often common to put them in the parameters
section, but then that seems to prevent remove-parameter
from working. I've also seen a few other cases where transforms may not work because not all (any?) $ref
s have been resolved. Seems transforms shouldn't have to worry about this, though I've had to on several occasions. This makes transforms less resilient.
Directive are simple transforms running a given node, doing ref resolution is much more complex, this would also probably have unexpected consequence where you'd expect the parmeter to only be modified for a single operation and it ends up changing the parameter for all
But shouldn't transforms work over the fully-resolved swagger? I would expect all $ref
s to have already been flattened by then. It'd be a lot of extra work to have transforms (wrapped in friendly directives like remote-parameter
or otherwise) to have to take both syntaxes into account.
/cc @tg-msft
no transforms runs immediately after swagger is loaded. The merged swagger makes no sense to a user, every definition has been renamed to prevent collision and it wouldn't be a good place to run transforms. Including that feature which would require a lot of logic to be included in the directive itself, would also not work if the refs are cross files(Directives are un in the scope of a single file and have no idea about others) so don't see this being added as ultimately will get complains that this only work in some scenarios.
you can always declare your own reusable directive that fits your scenario and makes it easier to consume it later