Skip to content

Conversation

@f18m
Copy link
Contributor

@f18m f18m commented Oct 14, 2020

This MR modifies the MODEL C++ source code to throw an exception whenever trying to set an unsupported enum value inside the model class, instead of silently dropping the set() command.

This is consistent with the usage for the c++ restbed server of Boost::ptree which already throws exceptions in case of invalid data type translations (see https://www.boost.org/doc/libs/1_74_0/boost/property_tree/exceptions.hpp)

With this MR the caller can detect invalid JSON/schema provided as input to the REST APIs just by catching std::runtime_error exceptions. A possible improvement would be introducing a custom class for such exceptions...

@f18m
Copy link
Contributor Author

f18m commented Nov 15, 2020

Ping on this PR...

@f18m
Copy link
Contributor Author

f18m commented Nov 15, 2020

Should I regen the petstore example files?

@f18m f18m changed the title Allow to implement validation of input data for enumerations [cpp-restbed-server] Allow to implement validation of input data for enumerations Nov 15, 2020
@f18m
Copy link
Contributor Author

f18m commented Nov 17, 2020

Hi @wing328 ,
Since you already handled the MR #7679 about the restbed server can you have a look at this MR as well?
thanks!

@etherealjoy
Copy link
Contributor

etherealjoy commented Nov 27, 2020

Should I regen the petstore example files?

Do you have changes if you regen, if so please commit them too. Changes seems OK

@f18m
Copy link
Contributor Author

f18m commented Nov 28, 2020

Should I regen the petstore example files?

Do you have changes if you regen, if so please commit them too. Changes seems OK

done now!

@etherealjoy
Copy link
Contributor

@etherealjoy
Copy link
Contributor

@wing328

@wing328 wing328 merged commit bb6785a into OpenAPITools:master Dec 8, 2020
@wing328 wing328 added this to the 5.0.0 milestone Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants