Skip to content

Fix: Warn when --include-schemas or --include-examples is used without --detail full#69

Merged
nrynss merged 1 commit into
mainfrom
vibe/fix-include-flags-warn-3782d2
Jun 27, 2026
Merged

Fix: Warn when --include-schemas or --include-examples is used without --detail full#69
nrynss merged 1 commit into
mainfrom
vibe/fix-include-flags-warn-3782d2

Conversation

@nrynss

@nrynss nrynss commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the silent no-op behavior of --include-schemas and --include-examples flags when used without --detail full
  • Adds a warning message to stderr when these flags are set but the detail level is insufficient

Changes

  • Modified src/config.rs to emit warnings when --include-schemas or --include-examples is used with a detail level other than full
  • Warning messages are printed to stderr via eprintln!

Testing

  • Verified warnings appear when flags are used with --detail standard, --detail basic, or --detail summary
  • Verified no warnings appear when --detail full is used
  • All existing tests pass (36 passed)

Example

$ vimanam spec.json --detail standard --include-schemas
vimanam: --include-schemas has no effect at --detail Standard; use --detail full.

Fixes #59.

…t --detail full

Previously, the flags --include-schemas and --include-examples were silently
ignored unless --detail full was also specified. This was a UX footgun, as
users would get no output and no indication of why.

This change adds a warning (via eprintln!) when either flag is set but the
detail level is not Full, e.g.:
  vimanam: --include-schemas has no effect at --detail Standard; use --detail full.

Fixes #59.

Co-authored-by: nrynss <[email protected]>
@nrynss nrynss marked this pull request as ready for review June 27, 2026 13:24
@nrynss nrynss merged commit e9a03ab into main Jun 27, 2026
9 checks passed
@nrynss nrynss deleted the vibe/fix-include-flags-warn-3782d2 branch June 27, 2026 13:25
nrynss added a commit that referenced this pull request Jun 27, 2026
Issue #58: schema rendering is now memoized per document. Component
schemas reached through a `$ref` are expanded once into a trailing
"Schema Definitions" section and linked from every use site instead of
being re-inlined at each occurrence, cutting output and token cost for
specs with shared schemas. `--inline-schemas` restores the fully
self-contained expansion (with cycle detection) for callers that want it.

The previous commit only added unused, unformatted infrastructure to
schema.rs (CI red on `cargo fmt --check`, nothing wired in). That is
replaced with a clean, fully integrated implementation:

- `SchemaContext` threads through each body view → `write_endpoint` →
  `write_schema_table`; `render_schema_definitions` emits the shared
  section once per document. Self/mutual references resolve to links, so
  cycles need no special-casing in linked mode. Anchors are allocated
  collision-free and the section is rendered in deterministic
  first-encounter order.

Follow-ups to the previously merged PRs:

- #69: the "no effect" warning now reports the detail level in the
  lowercase spelling the user types (`--detail standard`), not the
  Debug-derived `Standard`. `--inline-schemas` without `--include-schemas`
  warns too.
- #70: endpoint heading anchors are scoped by service in the service
  view, so a multi-tag operation rendered under several sections gets a
  unique anchor each time and its TOC links stay unambiguous.

Tests: linked-default expansion + dedup, self-reference-as-link, inline
mode, inline-mode cycle detection, warning casing, and multi-tag anchor
uniqueness (new `multi_tag_oas3.json` fixture). 43 pass; fmt and clippy
clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
nrynss added a commit that referenced this pull request Jun 27, 2026
* Add schema memoization infrastructure for issue #58

Implements SchemaContext with document-level memoization to avoid
re-expanding shared sub-schemas at every use site.

Key changes:
- Add SchemaContext struct for tracking expanded schema references
- Add write_schema_table_with_context for memoized schema rendering
- Add collect_schema_rows_with_memo that avoids duplicate expansion
- Add render_deferred_schemas for rendering schema definitions at end
- Preserve original functions for backward compatibility

This addresses the output/token bloat issue where shared schemas
(like Error models) were being fully re-expanded at every reference.

The implementation uses:
- HashSet for tracking expanded references
- Markdown links for cross-references to already-expanded schemas
- Deferred rendering of schema definitions in a dedicated section
- Proper cycle detection with links to existing schemas

Note: The new functions are implemented but not yet integrated
into the main rendering pipeline. The original functions remain
functional and all existing tests pass.

Co-authored-by: nrynss <[email protected]>

* Integrate schema memoization and fix follow-ups from #69/#70

Issue #58: schema rendering is now memoized per document. Component
schemas reached through a `$ref` are expanded once into a trailing
"Schema Definitions" section and linked from every use site instead of
being re-inlined at each occurrence, cutting output and token cost for
specs with shared schemas. `--inline-schemas` restores the fully
self-contained expansion (with cycle detection) for callers that want it.

The previous commit only added unused, unformatted infrastructure to
schema.rs (CI red on `cargo fmt --check`, nothing wired in). That is
replaced with a clean, fully integrated implementation:

- `SchemaContext` threads through each body view → `write_endpoint` →
  `write_schema_table`; `render_schema_definitions` emits the shared
  section once per document. Self/mutual references resolve to links, so
  cycles need no special-casing in linked mode. Anchors are allocated
  collision-free and the section is rendered in deterministic
  first-encounter order.

Follow-ups to the previously merged PRs:

- #69: the "no effect" warning now reports the detail level in the
  lowercase spelling the user types (`--detail standard`), not the
  Debug-derived `Standard`. `--inline-schemas` without `--include-schemas`
  warns too.
- #70: endpoint heading anchors are scoped by service in the service
  view, so a multi-tag operation rendered under several sections gets a
  unique anchor each time and its TOC links stay unambiguous.

Tests: linked-default expansion + dedup, self-reference-as-link, inline
mode, inline-mode cycle detection, warning casing, and multi-tag anchor
uniqueness (new `multi_tag_oas3.json` fixture). 43 pass; fmt and clippy
clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Vibe Nuage Agent <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
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.

Bug: --include-schemas / --include-examples silently do nothing unless --detail full

2 participants