Skip to content

handle in path params#5

Open
DIDONAX wants to merge 2 commits into
triptix-tech:masterfrom
DIDONAX:handle-in-path-params
Open

handle in path params#5
DIDONAX wants to merge 2 commits into
triptix-tech:masterfrom
DIDONAX:handle-in-path-params

Conversation

@DIDONAX
Copy link
Copy Markdown

@DIDONAX DIDONAX commented May 25, 2026

std::ostream& header,
std::ostream& source);

void gen_member_init_from_seg(YAML::Node const& root,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used outside its own source file -> remove definition from header

Comment thread test/parameter_test.cc
@@ -0,0 +1,33 @@
#include "gtest/gtest.h"

#include "openapi/bad_request_exception.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group headers

Comment thread include/openapi/parse.h
T parse_segment(boost::urls::segments_view const& segs,
std::string_view name,
std::size_t idx) {
auto it = segs.begin();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it only needed in if block

Comment thread src/gen_types.cc
if (sv.ends_with('}')) {
sv.remove_suffix(1);
}
seg_idx.emplace(sv, i - 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 - 1 underflows?

Comment thread src/gen_types.cc
std::ostream& header,
std::ostream& source) {
const auto p = path.as<std::string_view>();
auto segs = p | std::views::split('/');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be inlined (not used afterwards and name is not telling anything)

Comment thread src/gen_types.cc
Comment on lines +443 to +444
auto const in_path =
p["in"].IsDefined() && p["in"].as<std::string_view>() == "path";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't repeat yourself - write a utility function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants