Option to disable validation in the API clients
Description
Currently, there's no way to disable validation in the API clients and therefore we cannot use the API clients to perform integration tests with the RESTful backend (e.g. the API client cannot send requests with incorrect values as the client validation rule will fail the operation)
We'll introduce an option (e.g. client_side_validation in the configuration object)
Swagger-codegen version
Latest master
Swagger declaration file content or url
Related issues
https://github.com/swagger-api/swagger-codegen/pull/5528 has been submitted for Ruby API client.
Suggest a Fix
If anyone wants to work on the enhancement, please reply to let us know.
Hey @arun-nalla, I would like to know how to disable client_side_validation in python? I went through your changes. The changes belonged to openapi-generator. I don't know how swagger-codegen uses openapi-generator. Is there a gflag or configuration param I can use to disable client_side_validation? I did try it as a param, but it shows as an unexpected keyword:
swagger_configuration = groups_client.Configuration(client_side_validation=False)
@subtleseeker the PR for swagger codegen is not merged yet. https://github.com/swagger-api/swagger-codegen/pull/9719
#9719 is merged - can this issue be closed?
@sebastian-hatala-leanix it looks like this is fixed in master but not the 3.x branch. What's the procedure for tracking that?
I tested this option out in the latest 2.x tag but was unable to make it work. Looking at the code, I don't think the Configuration object gets passed from the ApiClient to the instantiated model object. In this block of api_client.mustache, it instantiates the model object, passes kwargs into its constructor, but doesn't include self.configuration.
It's fixed by changing line 624 to:
kwargs = {'_configuration': self.configuration}
I can create a PR, but I want to make sure I'm not being dumb and forgetting to set something. Has anyone else been able to disable the client-side validation?
What's the status of this issue? I generated a python REST client via the swagger-codegen, but as stated by @spfjr, the configuration object is not passed to the models.
Is this the correct way doing it?
kwargs = {'_configuration': self.configuration}
Is this the correct way doing it? kwargs = {'_configuration': self.configuration}
This fix is needed and resolves the problems I have.