Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 15:07
    remioukrat closed #40
  • 15:07
    remioukrat commented #40
  • 12:47
    lganzzzo commented #40
  • Jan 25 14:24
    remioukrat commented #40
  • Jan 25 12:23
    lganzzzo commented #40
  • Jan 25 10:45
    lganzzzo labeled #385
  • Jan 25 10:45
    lganzzzo commented #385
  • Jan 25 10:37
    remioukrat opened #40
  • Jan 24 02:33
    formoon commented #385
  • Jan 24 02:30
    formoon opened #385
  • Jan 22 08:55
    remioukrat commented #384
  • Jan 20 23:45
    lganzzzo commented #384
  • Jan 20 17:57
    remioukrat closed #384
  • Jan 20 17:57
    remioukrat commented #384
  • Jan 20 17:39
    remioukrat edited #384
  • Jan 20 17:38
    remioukrat opened #384
  • Jan 20 13:45
    TheBestChenQiZhen reopened #383
  • Jan 20 13:42
    TheBestChenQiZhen commented #383
  • Jan 20 13:42
    TheBestChenQiZhen closed #383
  • Jan 20 13:42
    TheBestChenQiZhen commented #383
oat++
@oatpp_io_twitter

Hey, thanks for the update!
It looks like we are in the opposite time-zones:)

A decent amount of the logic in the libressl, mbedtls, and eventual openssl modules is similar, maybe in the future there may be some opportunity for refactoring this and maybe setting the TLS module at compile time when compiling oatpp.

Having some kind of uber TLS module is definitely a good idea. Not sure about making it a part of core oatpp module though - oatpp by design works with streams. It doesn't care about where that stream comes from, is it TCP or Bluetooth or TLS over Bluetooth or whatever. You just take oatpp as a stream processor and plug any stream provider to it.
But we'll see how things will work out in the future.

Please keep me updated on the progress, and ping me if you have any questions!
Alex Benedict
@abenedic
Yeah UTC-7 here. Sure that sounds sensible. I tend to have a bit of time in the morning(~8am locally) and around the end of day(~4pm) to work on open source projects. I have BoringSSL installed locally, so I was planning on just getting it to work first in the boringssl module and then use that as the base for the openssl module. I should have it currently at the point where I just need to change all the libTLS stuff to use the older interfaces from boringssl. I am planning on keeping the interfaces exactly the same so the current tests can be reused as much as possible, which should help with the "uber TLS" module later if you go that route.
oat++
@oatpp_io_twitter
Hah and I am currently in utc+7 on my vacation :)
Thats sounds great especially that you have experience with boringssl (as I dont have). It will be goot to have at least one tls module supporting tls1.3. So yeah it's a valuable effort!
rrajpaul
@rrajpaul
@bhorn I have updated my local copy of oatpp-mongocxxmapper to compile against oatpp v1.0.0
rrajpaul
@rrajpaul
@bhorn I tried to use the starter project with oatpp-mongocxxmapper but I felt that either progresql or the crud example would be better suited for the example.
Benedikt-Alexander Mokroß
@bamkrs
@rrajpaul nice that you got it running on 1.0.0, I wasn't able to bump it since my mongo-environment is gone and i had no time to set it up again. Could you fork the repository and create a pull-request to my repository? We could consider to make oatpp-mongocxxmapper an official module if enough data is aquired to prove its reliability. So we are really happy about any reports
rrajpaul
@rrajpaul
@bhorn I am still working on the starter project - got it to compile and run but not insert data or get data etc. Once I get get, post, put and delete working I will do a pull request
Benedikt-Alexander Mokroß
@bamkrs
@rrajpaul nice! thank you.
rrajpaul
@rrajpaul
@bhorn I am getting an error when trying to return a dto object from a bsoncxx::v_noabi::document using readFromDocument
@bhorn

@bhorn -- sample DTO
// StyleDto.hpp
// crud
//
// Created by Leonid on 3/13/18.
// Modified by Ryan Rajpaul 01/31/2020
// Copyright © 2018 oatpp. All rights reserved.
//

ifndef DTOs_hpp

define DTOs_hpp

include "oatpp/core/data/mapping/type/Object.hpp"

include "oatpp/core/macro/codegen.hpp"

include OATPP_CODEGEN_BEGIN(DTO)

class StyleDto : public oatpp::data::mapping::type::Object {

DTO_INIT(StyleDto, Object)

DTO_FIELD(Int32, StyleId);
DTO_FIELD(String, Manufacturer, "Manufacturer");
DTO_FIELD(String, Brand, "Brand");
DTO_FIELD(String, Category, "Category");
DTO_FIELD(String, Type, "Type");
DTO_FIELD(String, Description, "Description");

};

include OATPP_CODEGEN_END(DTO)

endif / DTOs_hpp /

@bhorn -- method below StyleDto::ObjectWrapper Database::getStyleById(v_int32 id){
bsoncxx::stdx::optional<bsoncxx::v_noabi::document::value> result =
m_db[COLLECTION_NAME].find_one({document{} << "StyleId" << id << finalize});

auto docView = result->view();
auto style = m_mongomapper->readFromDocument(docView);

if(style) {
    OATPP_LOGD(TAG, "Found style with id %d", id);

    return style;
}
return style;

}

rrajpaul
@rrajpaul

@bhorn -- Method that will try to get a mongodb document by StyleId

StyleDto::ObjectWrapper Database::getStyleById(v_int32 id){
bsoncxx::stdx::optional<bsoncxx::v_noabi::document::value> result =
m_db[COLLECTION_NAME].find_one({document{} << "StyleId" << id << finalize});

auto docView = result->view();
auto style = m_mongomapper->readFromDocument(docView);

if(style) {
    OATPP_LOGD(TAG, "Found style with id %d", id);

    return style;
}
return style;

}

@bhorn sample json definition of a style document from style collection

{
"StyleId": NumberInt(4400),
"Manufacturer": "Acme Inc",
"Category": "Boys",
"Type": "Footwear",
"Description": "Running shoes"
}

Benedikt-Alexander Mokroß
@bamkrs
Hey @rrajpaul i will take a look tomorrow, its very hard to read on mobile
rrajpaul
@rrajpaul
No problem, I will keep at it thanks
Benedikt-Alexander Mokroß
@bamkrs
Hey @rrajpaul sorry for replying so late, kinda bussy atm. Do you still have the error? could you send me a pastebin of the error and a screenshot of your stack?
rrajpaul
@rrajpaul
fix the error, my bad as I did not do readFromDocument<StyleDto::ObjectWrapper>
@bhorn the fork for oatpp-mongocxxmapper is now on my github at https://github.com/rrajpaul/oatpp-mongocxxmapper
rrajpaul
@rrajpaul
I am having a different sort of issue issue Floating point exception (core dumped) I have uploaded my local project to https://github.com/rrajpaul/oatpp-mongodb-example. If you can take a look
rrajpaul
@rrajpaul
@bhorn I have figured what is causing the error - it was swagger component
Benedikt-Alexander Mokroß
@bamkrs
@rrajpaul great to hear and see your progress! If you have any further issues, we can help you the most if you screenshot your error and stacktrace. If its too much to screenshot, you can also upload it to pastebin or similar.
rrajpaul
@rrajpaul
@bhorn I have updated the example project name to example-mongodb and i used the README.md from the CRUD example.
@bhorn I will update the tests as they do not work.
@bhorn the link to the mongodb example project is https://github.com/rrajpaul/example-mongodb
note8g2018
@note8g2018
hi
do you know how to install LibreSSL in windows 10?
Benedikt-Alexander Mokroß
@bamkrs
Hi @note8g2018 libressl has a README.windows in their repository, https://github.com/libressl-portable/portable/blob/master/README.windows I think this explains everything :)
codderembedded
@codderembedded
Hi, I am trying my-service example. I want to create an endpoint that performs file operations. I want to take base64 data, convert it to string and save it in txt file. How can I do it? How can I convert to std::string from oatpp::String?
oat++
@oatpp_io_twitter

Hello @codderembedded ,

I want to take base64 data, convert it to string and save it in txt file. How can I do it?

#include "oatpp/encoding/Base64.hpp"

...

oatpp::String base64Data = "SGVsbG8gV29ybGQh";
oatpp::String plainData = oatpp::encoding::Base64::decode(base64Data);
plainData->saveToFile("/path/to/file.txt");
How can I convert to std::string from oatpp::String?
  oatpp::String oatppString = "Hello World!";
  std::string stdString = oatppString->std_str();
Please let me know if you have more questions!
codderembedded
@codderembedded
thank you very much
codderembedded
@codderembedded
How can I convert to oatpp::String from int
oat++
@oatpp_io_twitter
Hey @codderembedded , please find the ConversionUtils.hpp - https://github.com/oatpp/oatpp/blob/master/src/oatpp/core/utils/ConversionUtils.hpp#L140
rrajpaul
@rrajpaul
@bhorn I have changed the mongodb example (https://github.com/rrajpaul/example-mongodb) to use the same dto as the crud example and I still need to update the database setup in the README.md and the update the unit test, I hoping to get it done by this Sunday
rrajpaul
@rrajpaul
@bhorn Updated the database setup and provided a script to automate the process, now doing the unit tests
@bhorn take a look and let me know if you have any suggestions
rrajpaul
@rrajpaul
How do I pass parameter for unit testing for example to test the crud method getUserById
oat++
@oatpp_io_twitter

Hello @rrajpaul ,

How do I pass parameter for unit testing for example to test the crud method getUserById

The recommended way to test oatpp controllers is described here.
The basic idea - is that you create an ApiClient for you ApiController and then you do regular HTTP calls to your server.

Please let me know if you have more questions.

Regards,
Leonid

Sanzona
@Sanzona
image.png
When i try run this sample, i got this error.
oat++
@oatpp_io_twitter

Hey @Sanzona ,

Thanks for sharing this issue. We'll have to update the documentation!

Just pass m_objectMapper variable as is without .get():

  std::shared_ptr<OutgoingResponse> handle(const std::shared_ptr<IncomingRequest>& request) override {
    auto message = MessageDto::createShared();
    message->statusCode = 1024;
    message->message = "Hello DTO!";
    return ResponseFactory::createResponse(Status::CODE_200, message, m_objectMapper);
  }
Bob Tolbert
@rwtolbert
ok, kind of a strange request, but does anyone have an example of reading a file into a DTO object?
as in a JSON file, specifically
oat++
@oatpp_io_twitter
Hello @rwtolbert
The simplest way:
    oatpp::String json = oatpp::base::StrBuffer::loadFromFile("/path/to/file");
    auto myDto = objectMapper->readFromString<MyDto>(json);
Regards,
Leonid