by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    oat++
    @oatpp_io_twitter
    Yes, you are right - just clone the stater and modify it to your needs.
    Currently there is no oatpp-admin like in django. But it is a good idea to have one in future
    @pouyapanahandeh
    Starter is just a boilerplate precreated for you to start easier
    pooya
    @pouyapanahandeh
    now I got it, one more question, do you have any doc how to set up the web app that written in oatpp on AWS or Azure?
    oat++
    @oatpp_io_twitter
    Yes, there is no specific env setup for clouds. You can find some info here https://oatpp.io/docs/installation/unix-linux/
    Basically you have to install c++ compiler and oatpp
    Build your app and its done
    However there might be some additional things depending on the OS you choose
    pooya
    @pouyapanahandeh
    I got it, Thanks a lot for your help and time
    oat++
    @oatpp_io_twitter
    Just text me if you face any problems. It would be helpfull for the project to know all the potential issues
    pooya
    @pouyapanahandeh
    Sure, I will
    Panda805
    @Panda805
    Hi ,there.
    Can you tell me your por in detail?
    oat++
    @oatpp_io_twitter
    Hello @Panda805 ,
    Please specify what exactly you want to know?
    I'll be happy to share the info
    Marco Leclerc
    @ke9
    hi, anyone familiar with oatpp-consul?
    oat++
    @oatpp_io_twitter
    Hello @ke9 what do you need a help with ?
    Marco Leclerc
    @ke9
    hi, wondering if the deserializer in the Client class should allow unknown fields instead of not allowing them
    new fields added to an API would break "older" DTO code
    I'm working on adding support for sessions in the Client
    Marco Leclerc
    @ke9
    oat++
    @oatpp_io_twitter

    @ke9 ,

    I think that you are right. It is better to have allowUnknownFields == true for better compatibility with Consul API.

    RES
    @madkote
    hello here, is there a recommendation which async redis client can be used (or better fits into) in aot++ framework?
    and a usage example would be also very helpful... Thanks in advance!
    oat++
    @oatpp_io_twitter

    Hello @madkote ,

    I don't have any direct recommendations, but there are some points to consider:

    • If you are using oatpp Simple API - then it should be very easy to use any Redis client, and the process of integration should be straight forward.
    • If you are using oatpp Async API - then things become more complicated because, in oatpp-coroutines, you have to user oatpp-coroutines based API. It also depends on what kind of Redis API you are planning to use...
      • Redis Key-Value - you'll need to do additional synchronization code. All Redis read/write should be done in the separate thread, and coroutine should wait asynchronously for the result from that thread.
      • Pub/Sub - should be comparably easy to implement. You publish from a separate thread. If there is a message for subscriber, you spawn new oatpp-coroutine to handle that message.

    Something like that...
    Please let me know if you have more questions.

    RES
    @madkote
    @oatpp_io_twitter thx for reply.
    Simple API is clear. regarding async - I would like to avoid running redis commands in threads, therfore my question if there is any recommendation for native async redis lib.
    I will look around.. thx
    MJLHThomassen-Sorama
    @MJLHThomassen-Sorama
    Hello, i have a question regarding DTO's and inheritance.
    I have 2 DTO's, one "Base" and one that inherits from this. As i udnerstand it, i need to pass the class name that gets inherited from to DTO_EXTENDS like this
    DTO_INIT(ChildDto, BaseDto)
    instead of
    DTO_INIT(ChildDto, Object)
    when i do this, i get runtime errors trying to access a property of the BaseDto on an instance of ChildDto
    Also, maybe this has to do with the fact that the property i try to access in the BaseDto definition is itself a Dto
    class HeaderDto : public oatpp::data::mapping::type::Object
    {
    DTO_INIT(HeaderDto, Object)
            DTO_FIELD(Int64, time);
    
        };
    
        class ResponseDto : public oatpp::data::mapping::type::Object 
        {
            DTO_INIT(ResponseDto, Object)
    
            DTO_FIELD(HeaderDto::ObjectWrapper, header);
        };
    i try to access field "time" on ResponseDto object via field "header"
    so
    auto dto = ResponseDto::createShared();
    dto->header->time = 0;
    oat++
    @oatpp_io_twitter
    Hello @MJLHThomassen-Sorama , and welcome.
    Let me double-check this. Will get back to you shortly.
    MJLHThomassen-Sorama
    @MJLHThomassen-Sorama
    Hey @oatpp_io_twitter , thanks!
    oat++
    @oatpp_io_twitter
    Hey @MJLHThomassen-Sorama
    please see the full working example:
    
    #include "oatpp/parser/json/mapping/ObjectMapper.hpp"
    #include "oatpp/core/macro/codegen.hpp"
    #include <iostream>
    
    #include OATPP_CODEGEN_BEGIN(DTO)
    
    class MyBaseDto : public oatpp::data::mapping::type::Object {
    
      DTO_INIT(MyBaseDto, Object)
    
      DTO_FIELD(String, myBaseDtoField);
    
    };
    
    class HeaderDto : public MyBaseDto /* Should also extend a class here */ {
    
      DTO_INIT(HeaderDto, MyBaseDto)
    
      DTO_FIELD(Int64, time);
    
    };
    
    class ResponseDto : public oatpp::data::mapping::type::Object {
    
      DTO_INIT(ResponseDto, Object)
    
      DTO_FIELD(HeaderDto::ObjectWrapper, header) = HeaderDto::createShared(); // Don't forger to initialize object
    
    };
    
    #include OATPP_CODEGEN_END(DTO)
    
    void run() {
    
      auto dto = ResponseDto::createShared();
      dto->header->time = 0;
      dto->header->myBaseDtoField = "Hello base class";
    
      auto objectMapper = oatpp::parser::json::mapping::ObjectMapper::createShared();
    
      auto json = objectMapper->writeToString(dto);
    
      std::cout << json->c_str() << std::endl;
    
    }
    
    int main() {
    
      oatpp::base::Environment::init();
      run();
      oatpp::base::Environment::destroy();
    
      return 0;
    }
    MJLHThomassen-Sorama
    @MJLHThomassen-Sorama
    @oatpp_io_twitter ill try that, probably the initilizing the object went wrong, ill let you know if this works!
    oat++
    @oatpp_io_twitter
    Please also note that you have to extend object as a regular c++ object too:
    class HeaderDto : public MyBaseDto /* Should also extend a class here */ {
    
      DTO_INIT(HeaderDto, MyBaseDto /* mention your base class here */)
    
      DTO_FIELD(Int64, time);
    
    };
    MJLHThomassen-Sorama
    @MJLHThomassen-Sorama
    Yeah i already had that
    oat++
    @oatpp_io_twitter
    Ok then! Please let me know how it goes.
    MJLHThomassen-Sorama
    @MJLHThomassen-Sorama
    yes this seems to work
    thanks alot
    oat++
    @oatpp_io_twitter
    You are welcome, please ping me in case you have more questions
    MJLHThomassen-Sorama
    @MJLHThomassen-Sorama
    I was missing information on this in the documentation, and also examples / test / other code from modules (like the swagger module) does not utilize this in this way. Perhaps this can be added to the docs?
    oat++
    @oatpp_io_twitter
    Sure, good point!