Skip to content

Obtain name from SchemaObject; otherwise, keep existing default subtype_{idx} - #912

Open
dpezely wants to merge 1 commit into
oxidecomputer:mainfrom
dpezely:dpezely/subtype-naming
Open

Obtain name from SchemaObject; otherwise, keep existing default subtype_{idx}#912
dpezely wants to merge 1 commit into
oxidecomputer:mainfrom
dpezely:dpezely/subtype-naming

Conversation

@dpezely

@dpezely dpezely commented Oct 25, 2025

Copy link
Copy Markdown

Where existing behavior renders field names as subtype_0, this PR extracts a name from the relevant SchemaObject, when available.

  • Preserves existing behavior for fall-through cases
  • This scratches an itch from processing W3C's MNX current draft mnx-schema.json
    • e.g., had 60+ instances of subtype_0 through _4 in the resulting .rs file
    • That's as of their commit 0eda842 (latest as of creating this PR)
  • Existing tests pass

EDIT: revised URI under link, as W3C has separated official versus Community Groups

@ahl

ahl commented Oct 28, 2025

Copy link
Copy Markdown
Collaborator

Can you add a test that demonstrates this in action?

@dpezely

dpezely commented Oct 30, 2025

Copy link
Copy Markdown
Author

Short version: a minimal repo with a canary test that exercises this PR is mnx-canary.

Long version:

  • my JSON schema fu is weak
  • I have some experience modifying existing JSON schema but haven't created one from scratch prior to an attempt at writing a test case for this PR
  • The would-be test's schema.json started as a heavily trimmed version of the W3C mnx-schema.json but was still too verbose
  • potential schema for test
  • However, exercising that schema for purpose of this PR while being idomatic with existing Typify tests would require more time than I have at the moment
  • When time permits, I'll continue that effort but providing what I have now-- for keeping my response somewhat timely

@dpezely
dpezely force-pushed the dpezely/subtype-naming branch from 3f98086 to ac599b5 Compare February 5, 2026 17:55
@ahl

ahl commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

So this is going to improve things... but the handling of the anyOfs is still fundamentally broken (my fault--not yours). If this would be useful to you I'll have an LLM make some tests, but if and when we actually deal with anyOfs properly, we'll probably change all of this.

@dpezely

dpezely commented Aug 6, 2026

Copy link
Copy Markdown
Author

Yes, it would be useful. The JSON schema for MNX makes heavy use of it.

The W3C Community. working group has been very active adding to their schema, and it's been many months since I've attempted processing it. Let me update my canary repo-- hopefully this weekend or next. I'll post an update here.

Thank you!

PS - also updated link to their schema in initial post above due to W3C website reorg

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.

2 participants