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

Allow suppressing of required qualifier, instead add “required” as part of description! #17

Closed
isc-tstolker opened this issue Oct 13, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@isc-tstolker
Copy link
Collaborator

I just ran into a case where an openapi spec had a lot of "required" properties in the request model, however, the software offering the API did not comply to this themselves, causing our requests to fail.

I would like to be able to override generation of required properties so that "required" is added to the description instead of as a qualifier.

@lscalese lscalese self-assigned this Oct 14, 2023
@lscalese
Copy link
Owner

lscalese commented Oct 14, 2023

@isc-tstolker ,

I also experienced this kind of error due to a specification that did not match with the API.
If the specification specifies "required", we have to generate a required property.
But yes, it could be an option for the generation.

@lscalese lscalese added the enhancement New feature or request label Oct 14, 2023
lscalese added a commit that referenced this issue Oct 14, 2023
@lscalese
Copy link
Owner

I just change something in model generation to do this, result example :

/// 
/// * This property is required.
Property id As %String(MAXLEN = "");

/// A map containing service references and/or endpoints.
/// * This property is required.
Property serviceEndpoint As Nuts.Api.DidManager.model.CompoundServiceserviceEndpoint;

/// type of the endpoint. May be freely chosen.
/// * This property is required.
Property type As %String(MAXLEN = "");

To change the behavior, we have to set the features:

    set features("model.property.norequired")=1

Please change the entry point:

set sc = ##class(dc.openapi.client.Spec).generateApp(packageName, url, .features, externals)
; to 
Set sc = ##class(dc.openapi.suite.Generate).ProductionClient(packageName, url, .features, externals)

generateApp won't work with "model.property.norequired" and I would like to gather all entry generation point in the class dc.openapi.suite.Generate.

@isc-tstolker
Copy link
Collaborator Author

Super, that looks awesome!!

@isc-tstolker
Copy link
Collaborator Author

Great, works nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants