Skip to content

docs(api): add this.getOptions schema validation example#8208

Open
raj-sapalya wants to merge 1 commit intowebpack:mainfrom
raj-sapalya:docs/loader-api-getoptions-schema-example
Open

docs(api): add this.getOptions schema validation example#8208
raj-sapalya wants to merge 1 commit intowebpack:mainfrom
raj-sapalya:docs/loader-api-getoptions-schema-example

Conversation

@raj-sapalya
Copy link
Copy Markdown
Contributor

@raj-sapalya raj-sapalya commented Apr 25, 2026

What kind of change does this PR introduce?
Documentation improvement — adds a missing example for this.getOptions() with schema validation.

Summary

The this.getOptions(schema) API supports passing a JSON Schema for
automatic option validation, but the current docs show only a one-line
description with no example.

Many loader authors still use the separate schema-utils validate()
pattern because there is no example showing that this.getOptions()
handles validation natively when a schema is passed.

This PR adds a minimal working example showing:

  • passing a schema to this.getOptions()
  • accessing validated options inside a loader
  • using additionalProperties: false to catch unknown options at build start

Does this PR introduce a breaking change?
No.

What needs to be documented once your changes are merged?
Nothing additional.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment Apr 25, 2026 9:31am

Request Review

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.

1 participant