Skip to content

Add prefix-based inheritance to codegen#1028

Merged
mr-c merged 12 commits into
mainfrom
add-prefix-based-inheritance
Jun 29, 2026
Merged

Add prefix-based inheritance to codegen#1028
mr-c merged 12 commits into
mainfrom
add-prefix-based-inheritance

Conversation

@GlassOfWhiskey

@GlassOfWhiskey GlassOfWhiskey commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

This commit adds the possibility to specify a parent parser for each prefix in a Schema SALAD specification. The idea is that each extensions should come with a different namespace, and would define its own parser for its classes.

With this commit, a user can leverage the --codegen-parent option to explicitly map a prefix to a parent parser (e.g., a Python module) with a "prefix=package" syntax. For example:

--codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema"

Inheritance is not able to automatically reconstruct the whole class hierarchy, meaning that if B inherits from A and C inherits from B, the user must manually specify the mapping also for namespace A. However, we do not expect huge parser hierarchies for schema SALAD specifications.

Comment thread schema_salad/main.py Outdated
Comment thread src/schema_salad/main.py
@GlassOfWhiskey GlassOfWhiskey force-pushed the add-prefix-based-inheritance branch from 3784431 to 23a6f93 Compare April 24, 2026 11:15

@mr-c mr-c left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In general, this looks good! Lets see this output of this PR in action before we merge & release

@GlassOfWhiskey GlassOfWhiskey force-pushed the add-prefix-based-inheritance branch 7 times, most recently from ffabc7b to 862c21b Compare April 25, 2026 08:49
Comment thread schema_salad/python_codegen_support.py
Comment thread schema_salad/runtime.py Outdated
@GlassOfWhiskey GlassOfWhiskey force-pushed the add-prefix-based-inheritance branch 5 times, most recently from c679446 to 5338b18 Compare April 25, 2026 11:07
@codecov

codecov Bot commented Apr 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.01031% with 192 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.58%. Comparing base (d48545d) to head (33f6420).

Files with missing lines Patch % Lines
src/schema_salad/runtime.py 68.23% 67 Missing and 14 partials ⚠️
src/schema_salad/python_codegen_support.py 0.00% 71 Missing ⚠️
src/schema_salad/metaschema.py 77.27% 37 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1028      +/-   ##
==========================================
+ Coverage   70.82%   71.58%   +0.76%     
==========================================
  Files          52       53       +1     
  Lines       10118     9912     -206     
  Branches     2119     2058      -61     
==========================================
- Hits         7166     7096      -70     
+ Misses       2386     2264     -122     
+ Partials      566      552      -14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mr-c mr-c force-pushed the add-prefix-based-inheritance branch from 20741c2 to 600fb8d Compare April 28, 2026 13:41
Comment thread .github/workflows/ci-tests.yml Fixed
@mr-c mr-c force-pushed the add-prefix-based-inheritance branch 2 times, most recently from a9fc2c0 to 8cc33b7 Compare April 28, 2026 15:16
GlassOfWhiskey and others added 8 commits June 7, 2026 17:36
This commit adds th epossibility to specify a parent parser for
each prefix in a Schema SALAD specification. The idea is that each
extensions could come with a different namespace, and would define
its own parser for its classes.

With this commit, a user can leverage the `--codegen-parent` option
to explicitly map a prefix to a parent parser (e.g., a Python module)
with a "prefix=package" syntax. For example:

```bash
--codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema"
```

Inheritance is not able to automatically reconstruct the whole class
hierarchy, meaning that if B inherits from A and C inherits from B,
the user must manually specify the mapping also for namespace A.
However, we do not expect huge parser hierarchies for schema SALAD
specifications.
GlassOfWhiskey and others added 3 commits June 7, 2026 17:36
@mr-c mr-c force-pushed the add-prefix-based-inheritance branch from 8cc33b7 to dce82ba Compare June 7, 2026 15:36
@GlassOfWhiskey GlassOfWhiskey force-pushed the add-prefix-based-inheritance branch 2 times, most recently from 092af65 to 4628956 Compare June 25, 2026 17:25
@GlassOfWhiskey GlassOfWhiskey marked this pull request as ready for review June 25, 2026 17:39
@GlassOfWhiskey GlassOfWhiskey requested a review from mr-c June 25, 2026 17:39
@GlassOfWhiskey GlassOfWhiskey force-pushed the add-prefix-based-inheritance branch 3 times, most recently from 8262e2d to 4e0714d Compare June 25, 2026 18:12
@GlassOfWhiskey GlassOfWhiskey force-pushed the add-prefix-based-inheritance branch from 4e0714d to 33f6420 Compare June 25, 2026 18:13
@mr-c mr-c merged commit ee603d4 into main Jun 29, 2026
20 of 21 checks passed
@mr-c mr-c deleted the add-prefix-based-inheritance branch June 29, 2026 12:57
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.

3 participants