Skip to content

Commit b57fb5c

Browse files
committed
Merge branch 'develop' of github.com:userver-framework/userver into easy0
2 parents de0d755 + 296cbb9 commit b57fb5c

File tree

130 files changed

+2505
-1284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+2505
-1284
lines changed

.github/workflows/alpine.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Alpine Linux
2+
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- develop
9+
- feature/**
10+
11+
env:
12+
UBSAN_OPTIONS: print_stacktrace=1
13+
ASAN_OPTIONS: detect_odr_violation=2
14+
CXX: clang++-18
15+
16+
jobs:
17+
posix:
18+
strategy:
19+
fail-fast: false
20+
21+
name: Alpine Linux
22+
runs-on: ubuntu-24.04
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup latest Alpine Linux
30+
uses: jirutka/setup-alpine@v1
31+
32+
- name: Run script inside Alpine chroot as root
33+
shell: alpine.sh --root {0}
34+
run: |
35+
pwd
36+
cat /etc/alpine-release
37+
apk add $(cat scripts/docs/en/deps/alpine.md)
38+
39+
- name: Run cmake
40+
shell: alpine.sh {0}
41+
run: |
42+
pwd
43+
mkdir build_debug
44+
cd build_debug
45+
cmake \
46+
-DCMAKE_BUILD_TYPE=Debug \
47+
-DUSERVER_NO_WERROR=OFF \
48+
-DUSERVER_BUILD_ALL_COMPONENTS=1 \
49+
-DUSERVER_BUILD_SAMPLES=1 \
50+
-DUSERVER_BUILD_TESTS=1 \
51+
-DUSERVER_FEATURE_JEMALLOC=OFF \
52+
-DUSERVER_FEATURE_KAFKA=OFF \
53+
-DUSERVER_FEATURE_STACKTRACE=OFF \
54+
-DUSERVER_DOWNLOAD_PACKAGE_PROTOBUF=ON \
55+
-DUSERVER_DISABLE_RSEQ_ACCELERATION=YES \
56+
..
57+
58+
- name: Compile
59+
shell: alpine.sh {0}
60+
run: |
61+
cd build_debug
62+
cmake --build . -j$(nproc)
63+
64+
- name: Run tests
65+
shell: alpine.sh {0}
66+
run: |
67+
cd build_debug
68+
ctest -V

.github/workflows/docker.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
-DUSERVER_FEATURE_CORE=1
2323
-DUSERVER_FEATURE_CHAOTIC=0
2424
image: ubuntu-22.04-userver-base
25-
info: ubuntu + clang + cxx17 + core
25+
info: ubuntu + gcc + cxx17 + core
2626
id: ubuntu_clang_cxx17_core
2727
- cmake-flags: >-
2828
-DCMAKE_C_COMPILER=clang-16
@@ -50,7 +50,6 @@ jobs:
5050
-DCMAKE_C_COMPILER=clang-16
5151
-DCMAKE_CXX_COMPILER=clang++-16
5252
-DCMAKE_CXX_STANDARD=20
53-
-DUSERVER_NO_WERROR=0
5453
-DUSERVER_BUILD_ALL_COMPONENTS=1
5554
-DUSERVER_BUILD_SAMPLES=1
5655
-DUSERVER_BUILD_TESTS=1

.mapping.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
".github/dependabot.yml":"taxi/uservices/userver/.github/dependabot.yml",
99
".github/docker-compose.yml":"taxi/uservices/userver/.github/docker-compose.yml",
1010
".github/pull_request_template.md":"taxi/uservices/userver/.github/pull_request_template.md",
11+
".github/workflows/alpine.yml":"taxi/uservices/userver/.github/workflows/alpine.yml",
1112
".github/workflows/ci-conan.yml":"taxi/uservices/userver/.github/workflows/ci-conan.yml",
1213
".github/workflows/ci.yml":"taxi/uservices/userver/.github/workflows/ci.yml",
1314
".github/workflows/codeql-analysis.yml":"taxi/uservices/userver/.github/workflows/codeql-analysis.yml",
@@ -118,6 +119,9 @@
118119
"chaotic/include/userver/chaotic/io/userver/utils/strong_typedef.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/io/userver/utils/strong_typedef.hpp",
119120
"chaotic/include/userver/chaotic/object.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/object.hpp",
120121
"chaotic/include/userver/chaotic/oneof_with_discriminator.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/oneof_with_discriminator.hpp",
122+
"chaotic/include/userver/chaotic/openapi/parameters.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/openapi/parameters.hpp",
123+
"chaotic/include/userver/chaotic/openapi/parameters_read.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/openapi/parameters_read.hpp",
124+
"chaotic/include/userver/chaotic/openapi/parameters_write.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/openapi/parameters_write.hpp",
121125
"chaotic/include/userver/chaotic/primitive.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/primitive.hpp",
122126
"chaotic/include/userver/chaotic/ref.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/ref.hpp",
123127
"chaotic/include/userver/chaotic/timepoint_tz.hpp":"taxi/uservices/userver/chaotic/include/userver/chaotic/timepoint_tz.hpp",
@@ -179,6 +183,11 @@
179183
"chaotic/src/chaotic/io/userver/utils/datetime/date.cpp":"taxi/uservices/userver/chaotic/src/chaotic/io/userver/utils/datetime/date.cpp",
180184
"chaotic/src/chaotic/io/userver/utils/datetime/time_point_tz.cpp":"taxi/uservices/userver/chaotic/src/chaotic/io/userver/utils/datetime/time_point_tz.cpp",
181185
"chaotic/src/chaotic/io/userver/utils/datetime/time_point_tz_iso_basic.cpp":"taxi/uservices/userver/chaotic/src/chaotic/io/userver/utils/datetime/time_point_tz_iso_basic.cpp",
186+
"chaotic/src/chaotic/openapi/parameters.cpp":"taxi/uservices/userver/chaotic/src/chaotic/openapi/parameters.cpp",
187+
"chaotic/src/chaotic/openapi/parameters_read.cpp":"taxi/uservices/userver/chaotic/src/chaotic/openapi/parameters_read.cpp",
188+
"chaotic/src/chaotic/openapi/parameters_read_test.cpp":"taxi/uservices/userver/chaotic/src/chaotic/openapi/parameters_read_test.cpp",
189+
"chaotic/src/chaotic/openapi/parameters_write.cpp":"taxi/uservices/userver/chaotic/src/chaotic/openapi/parameters_write.cpp",
190+
"chaotic/src/chaotic/openapi/parameters_write_test.cpp":"taxi/uservices/userver/chaotic/src/chaotic/openapi/parameters_write_test.cpp",
182191
"chaotic/tests/back/cpp/conftest.py":"taxi/uservices/userver/chaotic/tests/back/cpp/conftest.py",
183192
"chaotic/tests/back/cpp/test_external.py":"taxi/uservices/userver/chaotic/tests/back/cpp/test_external.py",
184193
"chaotic/tests/back/cpp/test_tr_array.py":"taxi/uservices/userver/chaotic/tests/back/cpp/test_tr_array.py",
@@ -817,6 +826,7 @@
817826
"core/include/userver/server/http/http_error.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_error.hpp",
818827
"core/include/userver/server/http/http_method.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_method.hpp",
819828
"core/include/userver/server/http/http_request.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_request.hpp",
829+
"core/include/userver/server/http/http_request_builder.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_request_builder.hpp",
820830
"core/include/userver/server/http/http_response.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_response.hpp",
821831
"core/include/userver/server/http/http_response_body_stream.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_response_body_stream.hpp",
822832
"core/include/userver/server/http/http_response_body_stream_fwd.hpp":"taxi/uservices/userver/core/include/userver/server/http/http_response_body_stream_fwd.hpp",
@@ -826,7 +836,6 @@
826836
"core/include/userver/server/middlewares/configuration.hpp":"taxi/uservices/userver/core/include/userver/server/middlewares/configuration.hpp",
827837
"core/include/userver/server/middlewares/headers_propagator.hpp":"taxi/uservices/userver/core/include/userver/server/middlewares/headers_propagator.hpp",
828838
"core/include/userver/server/middlewares/http_middleware_base.hpp":"taxi/uservices/userver/core/include/userver/server/middlewares/http_middleware_base.hpp",
829-
"core/include/userver/server/request/request_base.hpp":"taxi/uservices/userver/core/include/userver/server/request/request_base.hpp",
830839
"core/include/userver/server/request/request_config.hpp":"taxi/uservices/userver/core/include/userver/server/request/request_config.hpp",
831840
"core/include/userver/server/request/request_context.hpp":"taxi/uservices/userver/core/include/userver/server/request/request_context.hpp",
832841
"core/include/userver/server/request/response_base.hpp":"taxi/uservices/userver/core/include/userver/server/request/response_base.hpp",
@@ -1507,6 +1516,7 @@
15071516
"core/src/server/http/http_error.cpp":"taxi/uservices/userver/core/src/server/http/http_error.cpp",
15081517
"core/src/server/http/http_method.cpp":"taxi/uservices/userver/core/src/server/http/http_method.cpp",
15091518
"core/src/server/http/http_request.cpp":"taxi/uservices/userver/core/src/server/http/http_request.cpp",
1519+
"core/src/server/http/http_request_builder.cpp":"taxi/uservices/userver/core/src/server/http/http_request_builder.cpp",
15101520
"core/src/server/http/http_request_constructor.cpp":"taxi/uservices/userver/core/src/server/http/http_request_constructor.cpp",
15111521
"core/src/server/http/http_request_constructor.hpp":"taxi/uservices/userver/core/src/server/http/http_request_constructor.hpp",
15121522
"core/src/server/http/http_request_constructor_benchmark.cpp":"taxi/uservices/userver/core/src/server/http/http_request_constructor_benchmark.cpp",
@@ -1515,7 +1525,6 @@
15151525
"core/src/server/http/http_request_handler.cpp":"taxi/uservices/userver/core/src/server/http/http_request_handler.cpp",
15161526
"core/src/server/http/http_request_handler.hpp":"taxi/uservices/userver/core/src/server/http/http_request_handler.hpp",
15171527
"core/src/server/http/http_request_headers_benchmark.cpp":"taxi/uservices/userver/core/src/server/http/http_request_headers_benchmark.cpp",
1518-
"core/src/server/http/http_request_impl.cpp":"taxi/uservices/userver/core/src/server/http/http_request_impl.cpp",
15191528
"core/src/server/http/http_request_impl.hpp":"taxi/uservices/userver/core/src/server/http/http_request_impl.hpp",
15201529
"core/src/server/http/http_request_method_test.cpp":"taxi/uservices/userver/core/src/server/http/http_request_method_test.cpp",
15211530
"core/src/server/http/http_request_parser.cpp":"taxi/uservices/userver/core/src/server/http/http_request_parser.cpp",
@@ -1580,9 +1589,7 @@
15801589
"core/src/server/pph_config.hpp":"taxi/uservices/userver/core/src/server/pph_config.hpp",
15811590
"core/src/server/request/internal_request_context.cpp":"taxi/uservices/userver/core/src/server/request/internal_request_context.cpp",
15821591
"core/src/server/request/internal_request_context.hpp":"taxi/uservices/userver/core/src/server/request/internal_request_context.hpp",
1583-
"core/src/server/request/request_base.cpp":"taxi/uservices/userver/core/src/server/request/request_base.cpp",
15841592
"core/src/server/request/request_config.cpp":"taxi/uservices/userver/core/src/server/request/request_config.cpp",
1585-
"core/src/server/request/request_constructor.hpp":"taxi/uservices/userver/core/src/server/request/request_constructor.hpp",
15861593
"core/src/server/request/request_context.cpp":"taxi/uservices/userver/core/src/server/request/request_context.cpp",
15871594
"core/src/server/request/request_context_test.cpp":"taxi/uservices/userver/core/src/server/request/request_context_test.cpp",
15881595
"core/src/server/request/request_parser.hpp":"taxi/uservices/userver/core/src/server/request/request_parser.hpp",
@@ -3352,6 +3359,7 @@
33523359
"scripts/docs/doxygen-awesome-css/doxygen-awesome.css":"taxi/uservices/userver/scripts/docs/doxygen-awesome-css/doxygen-awesome.css",
33533360
"scripts/docs/doxygen.conf":"taxi/uservices/userver/scripts/docs/doxygen.conf",
33543361
"scripts/docs/en/cpp/def_groups.hpp":"taxi/uservices/userver/scripts/docs/en/cpp/def_groups.hpp",
3362+
"scripts/docs/en/deps/alpine.md":"taxi/uservices/userver/scripts/docs/en/deps/alpine.md",
33553363
"scripts/docs/en/deps/arch.md":"taxi/uservices/userver/scripts/docs/en/deps/arch.md",
33563364
"scripts/docs/en/deps/debian-11.md":"taxi/uservices/userver/scripts/docs/en/deps/debian-11.md",
33573365
"scripts/docs/en/deps/fedora-35.md":"taxi/uservices/userver/scripts/docs/en/deps/fedora-35.md",
@@ -3555,6 +3563,7 @@
35553563
"scripts/sql/requirements.txt":"taxi/uservices/userver/scripts/sql/requirements.txt",
35563564
"scripts/sql/templates/sql.cpp.jinja":"taxi/uservices/userver/scripts/sql/templates/sql.cpp.jinja",
35573565
"scripts/sql/templates/sql.hpp.jinja":"taxi/uservices/userver/scripts/sql/templates/sql.hpp.jinja",
3566+
"scripts/tests/test_start_with_testsuite.sh":"taxi/uservices/userver/scripts/tests/test_start_with_testsuite.sh",
35583567
"scripts/uctl/uctl.bash_completion.sh":"taxi/uservices/userver/scripts/uctl/uctl.bash_completion.sh",
35593568
"scripts/uctl/uctl.py":"taxi/uservices/userver/scripts/uctl/uctl.py",
35603569
"testsuite/CMakeLists.txt":"taxi/uservices/userver/testsuite/CMakeLists.txt",

chaotic/CMakeLists.txt

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,10 @@ project(userver-chaotic CXX)
22

33
include(ChaoticGen)
44

5-
file(GLOB_RECURSE SOURCES
6-
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
7-
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp"
5+
userver_module(chaotic
6+
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
7+
UTEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*_test.cpp"
88
)
9-
add_library(${PROJECT_NAME} STATIC ${SOURCES})
10-
target_include_directories(
11-
${PROJECT_NAME}
12-
PUBLIC
13-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
14-
)
15-
target_link_libraries(${PROJECT_NAME} PUBLIC userver-universal)
169

1710
if(USERVER_BUILD_TESTS)
1811
userver_venv_setup(
@@ -36,12 +29,6 @@ if(USERVER_BUILD_TESTS)
3629
add_subdirectory(golden_tests)
3730
endif()
3831

39-
_userver_directory_install(COMPONENT chaotic
40-
DIRECTORY
41-
"${CMAKE_CURRENT_SOURCE_DIR}/include"
42-
DESTINATION
43-
"${CMAKE_INSTALL_INCLUDEDIR}/.."
44-
)
4532
_userver_directory_install(COMPONENT chaotic
4633
DIRECTORY
4734
"${CMAKE_CURRENT_SOURCE_DIR}/chaotic"
@@ -54,10 +41,6 @@ _userver_directory_install(COMPONENT chaotic
5441
DESTINATION
5542
"${CMAKE_INSTALL_BINDIR}"
5643
)
57-
_userver_install_targets(COMPONENT chaotic
58-
TARGETS
59-
${PROJECT_NAME}
60-
)
6144
_userver_directory_install(COMPONENT chaotic
6245
FILES
6346
"${USERVER_ROOT_DIR}/cmake/ChaoticGen.cmake"

chaotic/bin/chaotic-gen

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/sh
22

3-
BINDIR=`dirname $0`
3+
BINDIR=`dirname "$0"`
44
USERVER_PYTHON="${USERVER_PYTHON:-python3}"
55

6-
CHAOTIC_DIR=$BINDIR/..
7-
if ! [ -e $CHAOTIC_DIR/chaotic/main.py ]; then
8-
CHAOTIC_DIR=$BINDIR/../lib/userver/
6+
CHAOTIC_DIR="$BINDIR/.."
7+
if ! [ -e "$CHAOTIC_DIR/chaotic/main.py" ]; then
8+
CHAOTIC_DIR="$BINDIR/../lib/userver/"
99
fi
1010

11-
export PYTHONPATH=$CHAOTIC_DIR
11+
export PYTHONPATH="$CHAOTIC_DIR"
1212
exec "$USERVER_PYTHON" "$CHAOTIC_DIR/chaotic/main.py" "$@"

chaotic/chaotic/back/cpp/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ def __hash__(self) -> int:
2929
return id(self)
3030

3131
def is_isomorphic(self, other: 'CppType') -> bool:
32+
assert self.json_schema is not None
3233
left = dataclasses.asdict(self.json_schema)
3334
left.pop('description', None)
3435
left['x_properties'].pop('description', None)
35-
36+
assert other.json_schema is not None
3637
right = dataclasses.asdict(other.json_schema)
3738
right.pop('description', None)
3839
right['x_properties'].pop('description', None)
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#pragma once
2+
3+
#include <string>
4+
#include <vector>
5+
6+
USERVER_NAMESPACE_BEGIN
7+
8+
namespace chaotic::openapi {
9+
10+
enum class In {
11+
kHeader,
12+
kCookie,
13+
kPath,
14+
kQuery,
15+
kQueryExplode,
16+
};
17+
18+
using Name = const char* const;
19+
20+
template <typename T>
21+
inline constexpr bool kIsTrivialRawType = std::is_integral_v<T>;
22+
23+
template <>
24+
inline constexpr bool kIsTrivialRawType<bool> = true;
25+
26+
template <>
27+
inline constexpr bool kIsTrivialRawType<std::string> = true;
28+
29+
template <>
30+
inline constexpr bool kIsTrivialRawType<double> = true;
31+
32+
template <typename RawType_, typename UserType_>
33+
struct TrivialParameterBase {
34+
using RawType = RawType_;
35+
using UserType = UserType_;
36+
37+
static_assert(kIsTrivialRawType<RawType>);
38+
};
39+
40+
template <In In_, const Name& Name_, typename RawType_, typename UserType_ = RawType_>
41+
struct TrivialParameter {
42+
static constexpr auto kIn = In_;
43+
static constexpr auto& kName = Name_;
44+
45+
using Base = TrivialParameterBase<RawType_, UserType_>;
46+
47+
static_assert(kIn != In::kQueryExplode);
48+
};
49+
50+
template <In In_, char Delimiter_, typename RawItemType_, typename UserItemType_ = RawItemType_>
51+
struct ArrayParameterBase {
52+
static constexpr char kDelimiter = Delimiter_;
53+
static constexpr auto kIn = In_;
54+
55+
using RawType = std::vector<std::string>;
56+
using RawItemType = RawItemType_;
57+
using UserType = std::vector<UserItemType_>;
58+
using UserItemType = UserItemType_;
59+
};
60+
61+
template <In In_, const Name& Name_, char Delimiter_, typename RawItemType_, typename UserItemType_ = RawItemType_>
62+
struct ArrayParameter {
63+
static constexpr auto& kName = Name_;
64+
static constexpr auto kIn = In_;
65+
66+
using Base = ArrayParameterBase<In_, Delimiter_, RawItemType_, UserItemType_>;
67+
};
68+
69+
} // namespace chaotic::openapi
70+
71+
USERVER_NAMESPACE_END

0 commit comments

Comments
 (0)