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
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SPDX-FileCopyrightText: 2025 OPAL-RT Germany GmbH
# SPDX-License-Identifier: Apache-2.0

# Only run hooks for the pre-commit stage unless specified otherwise
default_stages: [pre-commit]

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
Expand Down
12 changes: 6 additions & 6 deletions common/lib/json.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Json configuration parsing implementation.
/* JSON configuration parsing implementation.
*
* Author: Philipp Jungkamp <philipp.jungkamp@rwth-aachen.de>
* SPDX-FileCopyrightText: 2024-2025 Institute for Automation of Complex Power Systems, RWTH Aachen University
Expand Down Expand Up @@ -149,7 +149,7 @@ void to_json(Json &json, JanssonPtr const &jansson) {

namespace {

// implementation of deprecated variable substitutions
// Implement the deprecated variable substitution syntax.
void expand_substitutions(Json &value, bool resolve_env,
fs::path const *include_dir) {
if (not value.is_string())
Expand All @@ -164,20 +164,20 @@ void expand_substitutions(Json &value, bool resolve_env,
auto do_include = false;
auto expanded = std::size_t{0};

// check for legacy @include keyword
// Check for deprecated @include directives.
if (include_dir and string.starts_with(DEPRECATED_INCLUDE_KEYWORD)) {
do_include = true;
expanded = DEPRECATED_INCLUDE_KEYWORD.length();
}

// legacy environment variable substitution syntax
// Check for deprecated environment variable substitutions.
static auto const env_regex = std::regex(R"--(\$\{([^}]+)\})--");
enum : std::size_t {
CAPTURE_ALL = 0,
CAPTURE_NAME,
};

// expand deprecated environment substition syntax
// Try to expand environment substitions.
std::smatch match;
while (resolve_env and std::regex_search(string.cbegin() + expanded,
string.cend(), match, env_regex)) {
Expand All @@ -193,7 +193,7 @@ void expand_substitutions(Json &value, bool resolve_env,
expanded += match.position() + env_value.length();
}

// expand deprecated @include directive
// Try to expand @include directives.
if (do_include) {
auto pattern =
std::string_view(string).substr(DEPRECATED_INCLUDE_KEYWORD.length());
Expand Down
3 changes: 2 additions & 1 deletion doc/openapi/components/schemas/config/node_obj.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
---
type: object
title: Format Object
title: Node Object
required:
- type
properties:
Expand All @@ -20,6 +20,7 @@ discriminator:
propertyName: type
mapping:
amqp: nodes/_amqp.yaml
c37.118: nodes/_c37_118.yaml
can: nodes/_can.yaml
comedi: nodes/_comedi.yaml
ethercat: nodes/_ethercat.yaml
Expand Down
7 changes: 7 additions & 0 deletions doc/openapi/components/schemas/config/nodes/_c37_118.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema=http://json-schema.org/draft-07/schema
# SPDX-FileCopyrightText: 2024-2025 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
---
allOf:
- $ref: ../node_obj.yaml
- $ref: c37_118.yaml
Loading
Loading