Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 19:11
    AlePart commented #705
  • Jan 27 23:21
    AlePart commented #705
  • Jan 27 21:15
    AlePart opened #705
  • Jan 24 21:28

    lganzzzo on master

    codegen: Fix QUERY(TYPE, NAME, … (compare)

  • Jan 24 14:05
    lganzzzo labeled #704
  • Jan 23 10:19
    chrzan123 commented #301
  • Jan 23 10:17
    chrzan123 commented #301
  • Jan 23 10:17
    chrzan123 commented #301
  • Jan 21 16:11
    lganzzzo commented #704
  • Jan 19 13:31
    A-dead-pixel commented #695
  • Jan 19 08:55
    harlanc opened #704
  • Jan 18 01:44

    lganzzzo on minor_code_cleanup

    (compare)

  • Jan 18 01:44

    lganzzzo on master

    parser::Caret: code cleanup Merge pull request #703 from oa… (compare)

  • Jan 18 01:44
    lganzzzo closed #703
  • Jan 18 01:28
    lganzzzo opened #703
  • Jan 18 01:28

    lganzzzo on minor_code_cleanup

    parser::Caret: code cleanup (compare)

  • Jan 16 22:18
    lganzzzo closed #660
  • Jan 16 22:18
    lganzzzo commented #660
  • Jan 16 22:15

    lganzzzo on fix_async_body_decoder

    (compare)

  • Jan 16 22:15

    lganzzzo on master

    SimpleBodyDecoder: Fix async me… Merge pull request #702 from oa… (compare)

EnderTheCoder
@EnderTheCoder
Because if I miss some param, the QUERY() will simply cause a crash
image.png
IO-create
@IO-create
Hi, I'd like to know if I can create an endpoint for sending files (using multipart or anything that works) and let users download their files through swagger UI? If yes, could you please provide me with an example?
williamwyc
@williamwyc
Is there an example using transferBodyToStreamAsync? I am facing a core dump when using it but not sure what did I do wrong
My code:
request->transferBodyToStreamAsync(std::make_shared<oatpp::data::stream::FileOutputStream>(FILEPATH));
jm130794
@jm130794
Hello,
Have you tried to run the example-jwt?
I did a test with docker-compose. The server is listening on port 8000 but when I try to access it with curl http://my-ip:8000/ , I get the following message: {"status": "ERROR", "code":401, "message": "Authorization Required"}
How to authenticate on this example?
Mike Ravenelle
@MikeRavenelle
I am having some issues trying to use conan with oatpp, I am following the example on https://conan.io/center/oatpp?tab=useit and CMake find_package is failing to find oatpp.
shijiantouzouyiqie
@shijiantouzouyiqie
Hello, everyone. In a simple Websocket program using thread real-time active data, the thread has HTTP request set global variable value, how to detect the change of global variable value in the thread?
Hello, HTTP request operation value and upgrade to the connection established for WebSocket, data can not be real-time interaction? Do you have an example?
Hello, everyone, server side simple Websocket to establish a connection, whether you can interrupt or close it?
Siva-Ph
@Siva-Ph
This message was deleted
Siva-Ph
@Siva-Ph
image.png
Hi, how to run this command in vcpkg during installation? I mean where the Flag variable need to put during installing oatpp-sqlite? I am getting error on windows with unofficial::sqlite3 detected. I tried few options that are suggested by other but none of them seems to work. Any suggestion would be great. I don't see the same on ubuntu.
oat++
@oatpp_io_twitter

Hello @MikeRavenelle , @Siva-Ph ,

You might find the answer in the Conan/vcpkg community.
oatpp officially distributed as a source code only - all package managers builds are community maintained

Hello @jm130794 ,

Have you tried to run the example-jwt?
I did a test with docker-compose. The server is listening on port 8000 but when I try to access it with curl http://my-ip:8000/ , I get the following message: {"status": "ERROR", "code":401, "message": "Authorization Required"}
How to authenticate on this example?

There is a signup endpoint - https://github.com/oatpp/example-jwt/blob/master/src/controller/AuthController.hpp#L38
You have to signup/login first to get the token

jm130794
@jm130794

OK for signUp.

Still with the example-jwt. I can't change the "limit" parameter. If I change the value to 20, the limit parameter always remains at 10

*   Trying 172.20.65.1:8008...
* Connected to 172.20.65.1 (172.20.65.1) port 8008 (#0)
> GET /stories/offset/6/limit/20 HTTP/1.1
> Host: 172.20.65.1:8008
> User-Agent: curl/7.81.0
> accept: application/json
> Authorization:  Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiI8bXktaXNzdWVyPiIsInVzZXJJZCI6IjI5NGVmM2Y4LTM4ZmMtNDE1OS1iYmU2LTY2NGNiZWQ4YzU3NSJ9.D86wBJ80KQ4nZcdO1gp1MfdFzKdrk6zJDU0j0V42sD8
> Content-Type: application/json
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 711
< Content-Type: application/json
< Server: oatpp/1.3.0
< Connection: keep-alive
< Access-Control-Max-Age: 1728000
< Access-Control-Allow-Headers: DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range, Authorization
< Access-Control-Allow-Methods: GET, POST, OPTIONS
< Access-Control-Allow-Origin: *
< 
* Connection #0 to host 172.20.65.1 left intact
{"offset":6,"limit":10,"count":10,"items":[{"id":"7af428c2-e2dd-4be7-bd3f-59cbb0c3e8b8","content":"STORY 7"},{"id":"39e5fe71-61f0-4555-8119-3e17584436e0","content":"STORY 8"},{"id":"360754f2-adca-47ce-82bd-a1e24ebc5414","content":"STORY 9"},{"id":"f1c457e0-25e9-493c-8abe-81a71f489e4e","content":"STORY 10"},{"id":"888d7a45-ac6e-4c4d-af1d-faab792473ba","content":"STORY 11"},{"id":"d5205068-42b6-41f5-8004-8f03c15625ef","content":"STORY 12"},{"id":"4faafb61-c151-487a-b57f-5bd4e5d56107","content":"STORY 13"},{"id":"8b6d77fd-ee92-40b6-aaa4-0e02a781af4f","content":"STORY 14"},{"id":"a21a72bf-a6cd-4ff7-aec1-7ffa178c8b42","content":"STORY 15"},{"id":"271a0481-6bd7-470c-af0f-ef017c10f103","content":"STORY 16"}]}

Do you have an explanation?

khazarmammadli
@khazarmammadli
Hi everybody! A question I have is regarding the "loadResources(//path/to/swagger/resources)" function. I wanted to know if it is possible to use this function with relative paths or does it have to be absolute. We run our test cases on different servers by passing the binaries and when setting OATPP_SWAGGER_RES_PATH during compile time, the passed path doesn't align with path that is stored in the said variable(It points to local path), which essentially leads to unwanted crashes. So is it possible to use this function with relative paths and if yes anything that I should be keeping in mind?
oat++
@oatpp_io_twitter
Hello @khazarmammadli , it should be possible to use relative paths - relative to executable
Please let me know if it worked
khazarmammadli
@khazarmammadli
Tried a few times with different functions but couldn’t seem to get it working, had to fall back to absolute paths
Another wuestion I have is if it possible to use the framework together with Address Sanitizer and Thread Sanitizer(The first one doesn’t seem to start the server aka getting only empty replies from the server and second one is having linkage errors as can’t find functions in oat++). Has anybody had experience with these? (i’ll attach the error messages as soon as possible)
khazarmammadli
@khazarmammadli
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::api::ApiController::getEndpointInfo(std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> > const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::api::ApiController::setEndpointInfo(std::
1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > const&, std::1::shared_ptr<oatpp::web::server::api::Endpoint::Info> const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::api::ApiController::getEndpointHandler(std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> > const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::api::ApiController::setEndpointHandler(std::
1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > const&, std::1::shared_ptr<oatpp::web::server::HttpRequestHandler> const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::api::Endpoint::createShared(std::1::shared_ptr<oatpp::web::server::HttpRequestHandler> const&, std::1::function<std::__1::shared_ptr<oatpp::web::server::api::Endpoint::Info> ()> const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::base::Environment::log(unsigned int, std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> > const&, std::1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::base::memory::MemoryPool::MemoryPool(std::
1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > const&, long, long) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::base::memory::ThreadDistributedMemoryPool::ThreadDistributedMemoryPool(std::
1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > const&, long, long, long) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::data::mapping::type::Type::Type(oatpp::data::mapping::type::ClassId const&, char const, void, std::
1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> >, oatpp::data::mapping::type::Type::AbstractInterpretation const*, std::1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > >, std::1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > >, std::1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > const, oatpp::data::mapping::type::Type::AbstractInterpretation const*> > >&&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::HttpConnectionHandler::createShared(std::
1::shared_ptr<oatpp::web::server::HttpRouterTemplate<std::__1::shared_ptr<oatpp::web::server::HttpRequestHandler> > > const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::server::api::ApiController::addEndpointsToRouter(std::1::shared_ptr<oatpp::web::server::HttpRouterTemplate<std::1::shared_ptr<oatpp::web::server::HttpRequestHandler> > > const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::protocol::http::outgoing::StreamingBody::StreamingBody(std::1::shared_ptr<oatpp::data::stream::ReadCallback> const&) [--no-allow-shlib-undefined]
ld.lld: error: ../../../lib/librest.so: undefined reference to oatpp::web::protocol::http::outgoing::Response::createShared(oatpp::web::protocol::http::Status const&, std::
1::shared_ptr<oatpp::web::protocol::http::outgoing::Body> const&) [--no-allow-shlib-un
oat++
@oatpp_io_twitter
@khazarmammadli , please post formatted messages. Please format error message as a code-block

Tried a few times with different functions but couldn’t seem to get it working, had to fall back to absolute paths

When oatpp::swagger::Resources tries to load files and it can't find them it prints out the path it's trying to use.
You may try to use it to debug files loading

shijiantouzouyiqie
@shijiantouzouyiqie
Hello everyone, there is an error using JSON structure, the server sends "ListValue[{}]" data without problem.
When the front-end browser sends a message, code=500 is displayed during server parsing.
What is the reason for this? Is there a better solution?
Server-side JSON data structure:
class DataReq: public oatpp::DTO {
    DTO_INIT(DataReq, DTO);
    DTO_FIELD(oatpp::String, Name);
    DTO_FIELD(oatpp::String, Value);
    DTO_FIELD(oatpp::List<oatpp::String>, ListValue);
    DTO_FIELD(oatpp::String, Enable);
};
class RequestDto: public oatpp::DTO {
    DTO_INIT(RequestDto, DTO);
    DTO_FIELD(oatpp::String, Com);
    DTO_FIELD(oatpp::Object<DataReq>, Data);
};
The data structure sent by the front end:
{
    "Com":"Set",
    "Data":{
        "Name":"List",
        "Value":"",
        "ListValue":[{
                "Index":"0",
            },{
                "Index":"1",
            }],
        "Enable":""
    }
}

Error message received by the front-end:
server=oatpp/1.3.0
code=500
description=Internal Server Error
message=[oatpp::parser::json::Utils::preparseString()]: Error. '"' - expected
shijiantouzouyiqie
@shijiantouzouyiqie
@oatpp_io_twitter May I ask if you have a better way?
oat++
@oatpp_io_twitter
Hey @shijiantouzouyiqie ,
You drclared ListValue field as a list of strings
But in JSON are sending it as a list of objects
You have to whether fix json or the data structure
1 reply
Kevin Benson
@kevinbenson1
Hello everyone. Is there a plan to tag a new release of oat++ anytime soon? There are some changes that have been committed since 1.3.0 that I would like to pull into our software. If it will be a while, I will just upgrade to 1.3.0 and add them as patches. In general, is additional testing performed on tagged releases? If not, maybe I will just pull in the latest trunk.
EnderTheCoder
@EnderTheCoder
image.png
Guys I was trying to use oatpp ADD_CORS()
it didn't seem to work on my reponse
image.png
any idea?
also i searched out every one of your example repos, I didn't see any that uses this micro param.
oat++
@oatpp_io_twitter

Hello @kevinbenson1 ,

Hello everyone. Is there a plan to tag a new release of oat++ anytime soon? There are some changes that have been committed since 1.3.0 that I would like to pull into our software. If it will be a while, I will just upgrade to 1.3.0 and add them as patches. In general, is additional testing performed on tagged releases? If not, maybe I will just pull in the latest trunk.

In the nearest two month there will be no new tag.
I suggest taking the latest master.
While we do additional testing on tag-builds, we encourage community to use the latest master and report bugs. - Crowd testing:)

1 reply

Hello @EnderTheCoder ,

Guys I was trying to use oatpp ADD_CORS()
it didn't seem to work on my reponse

From your screenshot - there is a response from oatpp server withcontent-type: application/json`.
So it worked.

oat++
@oatpp_io_twitter
Since there is a connection: close header (in the current implementation oatpp closes connection on unhandled errors) I assume that your service responded with error
But it's not the CORS problem
EnderTheCoder
@EnderTheCoder
okay, i got it, thanks for your help
oat++
@oatpp_io_twitter
Hello @emrahhisir , please format your post as a code snippet (see markdown formatting). Otherwise it's hard to read it
Emrah Hışır
@emrahhisir

Hi everyone,
I have a DTO class which consists of fields with other DTO class and I want to access these fields recursively.

Example DTO class:

class DTOSample : public oatpp::DTO {

  DTO_INIT(DTOSample, DTO /* Extends */)

  DTO_FIELD(Vector<Object<DTOSampleInner>>, inner);
};

class DTOSampleInner : public oatpp::DTO {

  DTO_INIT(DTOSampleInner, DTO /* Extends */)

  DTO_FIELD(String, name);
  DTO_FIELD(String, value);
};

accessFields(const oatpp::data::mapping::type::DTOWrapper<T> dto) {
    auto object = static_cast<oatpp::BaseObject *>(dto.get());
    auto fields = dto.getPropertiesList();
    for (auto const &field : fields) {
        auto value = field->get(object);
        // How can access name and value fields of DTOSampleInner
    }
}

Thanks.

oat++
@oatpp_io_twitter

Hello @emrahhisir ,

for (auto const &field : fields) {
  auto value = field->get(object);
  if(value.getValueType() == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id) {
          auto dispatcher = static_cast<const type::__class::AbstractObject::PolymorphicDispatcher*>(baseType->polymorphicDispatcher);
          const auto& map = dispatcher->getProperties()->getMap(); // <--- And again you get the properties map
  }
}

And since you have Vector of objects - you have first access items of the vector

Best place to search for code examples on this matter - is json serializer:
Emrah Hışır
@emrahhisir
Thanks @oatpp_io_twitter. I customized code in Serializer.cpp.
EnderTheCoder
@EnderTheCoder
Hello everyone. I'm looking for help with oatpp-postgresql model. I did not query with any Float32 param, but an error was given tells that it had problems with Float32 parsing. Do you have any ideas about this?