Skip to content
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

Option to disable validation in the API clients #5530

Open
wing328 opened this issue May 2, 2017 · 7 comments
Open

Option to disable validation in the API clients #5530

wing328 opened this issue May 2, 2017 · 7 comments

Comments

@wing328
Copy link
Contributor

wing328 commented May 2, 2017

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

#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.

@subtleseeker
Copy link

subtleseeker commented May 24, 2020

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)

@ghost
Copy link

ghost commented May 24, 2020

@subtleseeker the PR for swagger codegen is not merged yet. #9719

@ghost
Copy link

ghost commented Oct 18, 2021

#9719 is merged - can this issue be closed?

@apendleton
Copy link

@sebastian-hatala-leanix it looks like this is fixed in master but not the 3.x branch. What's the procedure for tracking that?

@spfjr
Copy link

spfjr commented Nov 19, 2021

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?

@Warcaith
Copy link

Warcaith commented Apr 24, 2022

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}

@jimdigriz
Copy link

Is this the correct way doing it?
kwargs = {'_configuration': self.configuration}

This fix is needed and resolves the problems I have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants