- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 552
Description
Describe the bug
I'm unable to add reference to components/parameters. Fields in with query value and String schema is automatically added by OpenApiResource despite these fields are properly defined in references parameter.
To Reproduce
I wanted to create reference to parameter as described in OpenAPI specification. We have our implementation of RepositoryRestResourceProvider which creates parameter (io.swagger.v3.oas.models.parameters.Parameter)
new Parameter.$ref("someReferencedParameter")($ref is the only parameter).
We also use OpenApiResource and the problematic code seems to be in AbstractOpenApiResource::calculatePath which contains:
if (!CollectionUtils.isEmpty(operation.getParameters()))
    operation.getParameters().forEach(parameter -> {
        if (parameter.getSchema() == null)
            parameter.setSchema(new StringSchema());
        if (parameter.getIn() == null)
            parameter.setIn(ParameterIn.QUERY.toString());
    }
);query value and string schema is added despite it's just reference where are properly defined different values.
Expected behavior
Generated parameter in OpenAPI schema should be:
{"$ref":"#/components/parameters/someReferencedParameter"}but was:
{"$ref":"#/components/parameters/someReferencedParameter","in":"query","schema":{"type":"string"}}Additional context
Used Springdoc version is 1.5.0. Version 1.5.9 seems to have the same mechanism according to the source code. I tried to upgrade but there are some incompatible changes which will take some time.
I'm not sure if it's bug or feature request. Is this behaviour intended? We used workaround with subclass of Parameter:
    private class RefParameter(referenceName: String) : Parameter() {
        init {
            `$ref` = referenceName
        }
        override fun getIn(): String? {
            return null
        }
        override fun getSchema(): Schema<*>? {
            return null
        }
    }Is there better solution?
Thank you!