Skip to content

1.12: structured patterns in an imported schema are no longer interpolated with the importing schema's settings #4135

Open

Description

@turbomam

In 1.12.1, linkml generate json-schema leaves {setting} placeholders as literal text when the structured_pattern is in an imported schema and settings: is in the importing one. 1.11.1 interpolates both. There's no warning. In nmdc-schema, SchemaView on src/schema/nmdc.yaml leaves 20 of 57 classes with {id_nmdc_prefix} in their id pattern (1.12.0 and 1.12.1).

main.yaml:

id: https://example.org/main
name: main
prefixes:
  linkml: https://w3id.org/linkml/
default_range: string
imports:
  - linkml:types
  - mod
settings:
  pfx: "ex"
classes:
  Local:
    attributes:
      id:
        identifier: true
        structured_pattern:
          syntax: "^{pfx}:local-[0-9]+$"
          interpolated: true

mod.yaml has the same shape with no settings:, class Imported, and syntax "^{pfx}:imp-[0-9]+$".

id pattern per class, measured 2026-10-14 with matching linkml and linkml-runtime versions:

linkml Local Imported
1.11.1 ^ex:local-[0-9]+$ ^ex:imp-[0-9]+$
1.12.1 ^(?:^ex:local-[0-9]+$)$ ^(?:^{pfx}:imp-[0-9]+$)$

I reported the ^(?:...)$ wrapping separately: #4134.

SchemaView.resolve_pattern says it uses "settings from the schema that defined the supplied definition", so this looks deliberate (#3832). @pkalita-lbl, could an imported schema fall back to the importing schema's settings? If not, could an unresolved placeholder at least raise a warning?

Activity

  1. turbomam commented on Oct 14, 2026

    @turbomam
    MemberAuthor

    Update from today's dev call: @pkalita-lbl explained that ^(?:...)$ wrapping is the intended partial_match fix (so I closed #4134), and that materialize_patterns is deprecated because induced_slot and induced_type now do the materialization.

    That doesn't change this issue. A structured_pattern in an imported schema with no settings: of its own still comes out with literal {pfx} placeholders on 1.12.1, where 1.11.1 used the importing schema's settings. The open questions are the same: should an imported schema fall back to the importing schema's settings, and if not, could an unresolved placeholder at least warn?

  2. turbomam commented on Oct 14, 2026

    @turbomam
    MemberAuthor

    Where settings: has to live for a pattern to resolve on linkml-runtime 1.12.1, tested 2026-10-14. The root schema has settings: {pfx: ex} and imports three modules; each class has an id with structured_pattern: {syntax: "^{pfx}:x-[0-9]+$", interpolated: true}.

    class defined in induced_slot("id", ...).pattern
    root module ^(?:^ex:d-[0-9]+$)$
    module that imports a shared settings-only module ^(?:^{pfx}:a-[0-9]+$)$
    module with its own settings: ^(?:^ex:b-[0-9]+$)$
    module with no settings ^(?:^{pfx}:c-[0-9]+$)$

    So settings come only from the defining module's own settings: (PatternResolver reads schema_view.schema.settings of that one schema), not from what it imports or what imports it. Putting all settings in the root module, which is how nmdc-schema and MIxS-derived schemas are laid out, is the case that breaks. Generating from a merged single-file schema works.

    Until there's a decision here, I'm planning to give each module its own settings: in nmdc-schema.

  3. added
    bugSomething that should work but isn't, with an example and a test case.
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NMDCbugSomething that should work but isn't, with an example and a test case.schemaview

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions