Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02
core https://github.com/sourcemeta/core 04e936961d1e31f6b70fa5a30e115b2f7855674a
jsonbinpack https://github.com/sourcemeta/jsonbinpack ac8e1af733a781fc4c94a14157f80970ea569479
blaze https://github.com/sourcemeta/blaze e73e5e1667487717b44ab351a0f46e01d507fefb
core https://github.com/sourcemeta/core bb1c78e8fa148a2ece951bb776798a43fe328821
jsonbinpack https://github.com/sourcemeta/jsonbinpack e2f99ed5e69ab17b027c3d7bb0ef95b27953bb08
blaze https://github.com/sourcemeta/blaze 04832d45bf4327d4ec874fa67f339797cd49b375
ctrf https://github.com/ctrf-io/ctrf 93ea827d951390190171d37443bff169cf47c808
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ to build from source if your distribution of choice is different.
> missing you can install it through your package manager (for example
> `apt install libcurl4`, `dnf install libcurl`, or `apk add libcurl`). If it
> lives in a non-standard location, point the CLI at it by setting the
> `SOURCEMETA_JSONSCHEMA_CURL_SO` environment variable to the full path of
> `SOURCEMETA_CORE_CURL_SO` environment variable to the full path of
> `libcurl.so.4`.

To verify the GPG signature of the checksums file:
Expand Down
3 changes: 3 additions & 0 deletions cmake/FindCore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ if(NOT Core_FOUND)
set(SOURCEMETA_CORE_LANG_PARALLEL OFF CACHE BOOL "Parallel")
set(SOURCEMETA_CORE_LANG_STACKTRACE OFF CACHE BOOL "Stacktrace")
set(SOURCEMETA_CORE_HTML OFF CACHE BOOL "HTML")
if(JSONSCHEMA_USE_SYSTEM_CURL)
set(SOURCEMETA_CORE_HTTP_USE_SYSTEM_CURL ON CACHE BOOL "Use system cURL")
endif()
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/core")
include(Sourcemeta)
set(Core_FOUND ON)
Expand Down
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
add_subdirectory(http)

sourcemeta_executable(
PROJECT jsonschema
NAME cli
Expand Down Expand Up @@ -46,7 +44,6 @@ target_link_libraries(jsonschema_cli PRIVATE sourcemeta::blaze::output)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::blaze::test)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::blaze::alterschema)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::blaze::codegen)
target_link_libraries(jsonschema_cli PRIVATE jsonschema_http)

configure_file(configure.h.in configure.h @ONLY)
target_include_directories(jsonschema_cli PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
Expand Down
3 changes: 1 addition & 2 deletions src/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <vector> // std::vector

#include "exit_code.h"
#include "http.h" // sourcemeta::jsonschema::HTTPDynamicBackendNotFound

namespace sourcemeta::jsonschema {

Expand Down Expand Up @@ -1099,7 +1098,7 @@ inline auto try_catch(const sourcemeta::core::Options &options,
const auto is_json{options.contains("json")};
print_exception(is_json, error);
return EXIT_UNEXPECTED_ERROR;
} catch (const sourcemeta::jsonschema::HTTPDynamicBackendNotFound &error) {
} catch (const sourcemeta::core::HTTPSystemBackendError &error) {
const auto is_json{options.contains("json")};
print_exception(is_json, error);
return EXIT_NOT_SUPPORTED;
Expand Down
25 changes: 0 additions & 25 deletions src/http/CMakeLists.txt

This file was deleted.

86 changes: 0 additions & 86 deletions src/http/http.h

This file was deleted.

19 changes: 9 additions & 10 deletions src/resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <sourcemeta/core/yaml.h>

#include "error.h"
#include "http.h"
#include "input.h"
#include "logger.h"
#include "utils.h"
Expand Down Expand Up @@ -135,19 +134,19 @@ collect_http_headers(const sourcemeta::core::Options &options)
static inline auto http_fetch(const std::string &url,
const sourcemeta::core::Options &options)
-> sourcemeta::core::JSON {
const HTTPRequest request{.method = sourcemeta::core::HTTPMethod::GET,
.url = url,
.headers = collect_http_headers(options),
.body = std::nullopt,
.maximum_response_size = std::nullopt};
HTTPResponse response;
sourcemeta::core::HTTPSystemRequest request{url};
for (const auto &header : collect_http_headers(options)) {
request.header(std::string{header.first}, std::string{header.second});
}

sourcemeta::core::HTTPResponse response;
for (std::uint8_t attempt{1}; attempt <= HTTP_MAXIMUM_RETRIES; ++attempt) {
LOG_VERBOSE(options) << "Resolving over HTTP (attempt "
<< static_cast<int>(attempt) << "/"
<< static_cast<int>(HTTP_MAXIMUM_RETRIES)
<< "): " << url << "\n";
try {
response = http_request(request);
response = request.send();
} catch (const sourcemeta::core::HTTPError &error) {
if (attempt == HTTP_MAXIMUM_RETRIES) {
throw;
Expand All @@ -171,8 +170,8 @@ static inline auto http_fetch(const std::string &url,
}

if (response.status != sourcemeta::core::HTTP_STATUS_OK) {
throw sourcemeta::core::HTTPStatusError{request.method, url,
response.status};
throw sourcemeta::core::HTTPStatusError{sourcemeta::core::HTTPMethod::GET,
url, response.status};
}

const auto content_type{
Expand Down
8 changes: 4 additions & 4 deletions test/ci/fail_validate_http_missing_curl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cat << 'EOF' > "$TMP/instance.json"
{ "type": "string" }
EOF

SOURCEMETA_JSONSCHEMA_CURL_SO="$TMP/does-not-exist.so" \
SOURCEMETA_CORE_CURL_SO="$TMP/does-not-exist.so" \
"$1" validate "$TMP/schema.json" "$TMP/instance.json" --http \
> "$TMP/stdout.txt" 2> "$TMP/stderr.txt" \
&& EXIT_CODE="$?" || EXIT_CODE="$?"
Expand All @@ -29,14 +29,14 @@ test "$EXIT_CODE" = "3"

cat << EOF > "$TMP/expected.txt"
error: Could not load the cURL library from the configured path
with environment variable SOURCEMETA_JSONSCHEMA_CURL_SO
with environment variable SOURCEMETA_CORE_CURL_SO
with paths
- $TMP/does-not-exist.so
EOF

diff "$TMP/stderr.txt" "$TMP/expected.txt"

SOURCEMETA_JSONSCHEMA_CURL_SO="$TMP/does-not-exist.so" \
SOURCEMETA_CORE_CURL_SO="$TMP/does-not-exist.so" \
"$1" validate "$TMP/schema.json" "$TMP/instance.json" --http --json \
> "$TMP/stdout_json.txt" 2> "$TMP/stderr_json.txt" \
&& EXIT_CODE="$?" || EXIT_CODE="$?"
Expand All @@ -46,7 +46,7 @@ test "$EXIT_CODE" = "3"
cat << EOF > "$TMP/expected_json.txt"
{
"error": "Could not load the cURL library from the configured path",
"environmentVariable": "SOURCEMETA_JSONSCHEMA_CURL_SO",
"environmentVariable": "SOURCEMETA_CORE_CURL_SO",
"paths": [ "$TMP/does-not-exist.so" ]
}
EOF
Expand Down
2 changes: 1 addition & 1 deletion vendor/blaze/DEPENDENCIES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 4 additions & 18 deletions vendor/blaze/schemas/canonical-draft3.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions vendor/blaze/src/alterschema/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading