Skip to content

feat: serve the spec as JSON#323

Merged
miketheman merged 2 commits into
Pylons:mainfrom
miketheman:feat/10-serve-json-spec
Jul 4, 2026
Merged

feat: serve the spec as JSON#323
miketheman merged 2 commits into
Pylons:mainfrom
miketheman:feat/10-serve-json-spec

Conversation

@miketheman

@miketheman miketheman commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

The spec dict is already parsed at registration time, so serving it as JSON is just another view on the same data. Off by default.

Resolves #10

The spec dict is already parsed at registration time, so serving it
as JSON is just another view on the same data. Off by default.

Resolves Pylons#10
@miketheman miketheman force-pushed the feat/10-serve-json-spec branch from 63e5047 to c22e325 Compare July 3, 2026 21:09
@miketheman miketheman requested a review from zupo July 3, 2026 21:09
@zupo

zupo commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Is there a cost to serving JSON? What if we serve it by default and reduce some code complexity?

json.dumps on an already-parsed dict is free, and the earlier opt-in
flag mostly added branching rather than avoiding real cost. The JSON
route path is derived from route (extension swapped to .json) so
multi-spec apps with different apinames don't collide.
@miketheman

Copy link
Copy Markdown
Collaborator Author

Fair question, I figured it wasn't there before, so this could be opt-in.

I pushed a second commit with serving json by default - let me know what you think of that approach if it's simpler/cleaner.

@miketheman miketheman changed the title feat: Add opt-in route_json param to serve the spec as JSON feat: serve the spec as JSON Jul 4, 2026
@miketheman miketheman added the enhancement New feature or request label Jul 4, 2026
@miketheman miketheman merged commit 0a5fa23 into Pylons:main Jul 4, 2026
2 checks passed
@miketheman miketheman deleted the feat/10-serve-json-spec branch July 4, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serve JSON spec too

2 participants