Skip to content

feat: export parseParams and related sanitizers#16788

Open
tak-amboss wants to merge 1 commit into
payloadcms:mainfrom
tak-amboss:feat/export-parse-params
Open

feat: export parseParams and related sanitizers#16788
tak-amboss wants to merge 1 commit into
payloadcms:mainfrom
tak-amboss:feat/export-parse-params

Conversation

@tak-amboss
Copy link
Copy Markdown
Contributor

@tak-amboss tak-amboss commented May 29, 2026

Summary

  • Exports parseParams from the main payload entrypoint along with its RawParams / ParsedParams types
  • Exports sanitizeSortParams (the remaining sanitizer used inside parseParams) and the JoinParams type for completeness alongside the already-exported sanitizeJoinParams / sanitizePopulateParam / sanitizeSelectParam

Why

Custom REST endpoints that shadow a built-in route (e.g. a collection endpoint at /versions/:id with additional customization) need the same query-string coercion the default handlers run.
parseParams already implements all of this, but it is not part of the package's exports map, which forces consumers to either deep-import via payload/dist/... or vendor a copy. Exposing it lets endpoint authors stay aligned with core behavior automatically.

sanitizeSortParams is the only sanitizer used by parseParams that was not already re-exported, and JoinParams is the input type of the already-exported sanitizeJoinParams — including both rounds out the surface.

Exposes parseParams, sanitizeSortParams, the JoinParams type, and the
RawParams/ParsedParams types from the main payload entrypoint so custom
REST endpoints that shadow built-in routes can apply the same query
coercion as the default handlers (booleans, numbers, sort splitting,
where/data JSON parsing, populate/select/joins sanitization) without
vendoring the implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant