Skip to content

Commit

Permalink
Merge pull request #19 from arntanguy/topic/RecursiveAllOf
Browse files Browse the repository at this point in the history
  • Loading branch information
arntanguy authored Mar 25, 2021
2 parents cfcc34d + 9cdbbe7 commit 9c81718
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
run: |
export PATH=/usr/local/opt/qt/bin:$PATH
echo "PATH=${PATH}" >> $GITHUB_ENV
export CMAKE_PREFIX_PATH=/usr/local/opt/qt:${CMAKE_PREFIX_PATH}
export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5:${CMAKE_PREFIX_PATH}
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV
- name: Install dependencies
uses: jrl-umi3218/github-actions/install-dependencies@master
Expand All @@ -94,7 +94,7 @@ jobs:
ubuntu: |
apt: cython cython3 python-nose python3-nose python-numpy python3-numpy python-coverage python3-coverage python-setuptools python3-setuptools libeigen3-dev doxygen doxygen-latex libboost-all-dev libtinyxml2-dev libgeos++-dev libnanomsg-dev libyaml-cpp-dev libltdl-dev qt5-default libqwt-qt5-dev
macos: |
brew: eigen boost tinyxml2 geos nanomsg yaml-cpp pkg-config libtool qt qwt gcc
brew: eigen boost tinyxml2 geos nanomsg yaml-cpp pkg-config libtool qt5 qwt gcc
pip: Cython coverage nose numpy
github:
- path: jrl-umi3218/mc_rtc_data
Expand Down
17 changes: 13 additions & 4 deletions mc_rtc_rviz_panel/src/Schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Schema::Schema(const std::vector<Schema> & schemas)
};
}

Schema::Schema(const mc_rtc::Configuration & s, const std::string & source, const std::string & title, bool required_in)
mc_rtc::Configuration Schema::resolveAllOf(const mc_rtc::Configuration & s, const std::string & source) const
{
if(s.has("allOf"))
{
Expand All @@ -57,22 +57,31 @@ Schema::Schema(const mc_rtc::Configuration & s, const std::string & source, cons
auto si = s("allOf")[i];
if(si.has("$ref"))
{
schema.load(mc_rtc::Configuration{ref_path(source, si("$ref"))});
schema.load(resolveAllOf(mc_rtc::Configuration{ref_path(source, si("$ref"))}, source));
}
else if(si.has("allOf"))
{
schema.load(resolveAllOf(si, source));
}
else
{
schema.load(si);
}
}
schema.remove("allOf");
init(schema, source, title, required_in);
return schema;
}
else
{
init(s, source, title, required_in);
return s;
}
}

Schema::Schema(const mc_rtc::Configuration & s, const std::string & source, const std::string & title, bool required_in)
{
init(resolveAllOf(s, source), source, title, required_in);
}

void Schema::init(const mc_rtc::Configuration & s,
const std::string & source,
const std::string & title,
Expand Down
4 changes: 4 additions & 0 deletions mc_rtc_rviz_panel/src/Schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ struct Schema

static SchemaStore & store();

private:
/** Recursively resolve allOf property */
mc_rtc::Configuration resolveAllOf(const mc_rtc::Configuration & s, const std::string & source) const;

private:
std::string title_;
bool is_object_ = false;
Expand Down

0 comments on commit 9c81718

Please sign in to comment.