Giter Club home page Giter Club logo

Comments (5)

lganzzzo avatar lganzzzo commented on June 15, 2024 1

I'll put instructions here later today.
Also, you may reach me in the oatpp devs chat on Gitter - https://gitter.im/oatpp-framework/Lobby (user oatpp_io_twitter)

In any case it should be two pretty simple PRs to oatpp and to oatpp-swagger

from oatpp-swagger.

lganzzzo avatar lganzzzo commented on June 15, 2024 1

How To Add New Info Property To DTO_FIELD_INFO:

In oatpp

Add new property to Property::Info - https://github.com/oatpp/oatpp/blob/master/src/oatpp/core/data/mapping/type/Type.hpp#L282

In oatpp-swagger

Document the new property here - https://github.com/oatpp/oatpp-swagger/blob/master/src/oatpp-swagger/oas3/Generator.cpp#L102

You may also need to extend the schema object.

Please let me know if you have any questions.

from oatpp-swagger.

lganzzzo avatar lganzzzo commented on June 15, 2024

Hello @natanael ,

Thanks for opening the issue!

The default values feature is currently not supported in Oat++.

However, it's pretty easy to add this functionality in the form of:

DTO_FIELD_INFO(name) {
  info->description = "user first name"; //<-- Fields description is integrated with Swagger-UI.
  info->default = "Ivan"; //<-- explicit declaration of default value.
}
DTO_FIELD(String, name, "yourName") = "Ivan"; //<-- unfortunately we can't track default value from this place.

So, I would propose whether to wait while we add this functionality (I'll. schedule it for the next nearest release 1.2.0)
or you may contribute and add it by yourself (I'll provide the assistance).

Best Regards,
Leonid

from oatpp-swagger.

natanael avatar natanael commented on June 15, 2024

Thanks for the quick reply!
I would love to contribute, but I'm prevented from doing it during business hours by contract, will try later today. Other than a simple PR is there anything I should keep in mind?

from oatpp-swagger.

natanael avatar natanael commented on June 15, 2024

Thanks so much for pointing me on the right direction! The PRs are:
oatpp/oatpp#276
#24
I named it default_value and implemented it as a string but one ideally would want it to match the field, maybe we can do that in a following issue.

from oatpp-swagger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.