Skip to content

docs: explain OpenAPI integer bounds generation - #1721

Open
jeeeeetshahhhhh wants to merge 3 commits into
PokeAPI:masterfrom
jeeeeetshahhhhh:fix/local-postgres-openapi-generation
Open

jeeeeetshahhhhh wants to merge 3 commits into
PokeAPI:masterfrom
jeeeeetshahhhhh:fix/local-postgres-openapi-generation

Conversation

@jeeeeetshahhhhh

@jeeeeetshahhhhh jeeeeetshahhhhh commented Nov 12, 2026 •

Copy link
Copy Markdown

Summary

  • document how to regenerate the OpenAPI schema using the existing generate-openapi pre-commit command
  • explain that the configured DB backend determines integer bounds and generation does not query a live database

Addresses #1623 by explaining why SQLite and PostgreSQL can produce different integer bounds and how to regenerate the schema consistently.

Validation

  • git diff --check

@FallenDeity

FallenDeity commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

hi @jeeeeetshahhhhh i am not sure if a new config or makefile command is required given that this is already a defined step in pre-commit steps anyone interested can just use this command manually as well

entry: uv run manage.py spectacular --file openapi.yml --settings=config.docker_compose

in fact this dosent require docker running or a local postgres the config only serves the purpose of telling django spectacular whats the backend db like and based on that it decides the int bounds from the db int type no actual query to db is made

what i could see however is we can make a note of this behavior somewhere in contributing

@jeeeeetshahhhhh jeeeeetshahhhhh changed the title fix: make local OpenAPI generation use PostgreSQL docs: explain OpenAPI integer bounds generation Nov 12, 2026
@jeeeeetshahhhhh

Copy link
Copy Markdown
Author

Thanks for clarifying. I removed the extra settings module and Make target, and moved the change to CONTRIBUTING.md. It now documents the existing manual generate-openapi command and explains that schema generation uses the configured backend's integer types without querying a running database.

Comment thread CONTRIBUTING.md
This command does not need a running database: the configured database backend determines integer bounds in the
schema, and schema generation does not query the database.

> [!NOTE]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like i missed removing this note when i enabled ty and ruff, can you update this note and move the above info into this note mentioning "if in case there are model or schema changes folks can simply run the pre-commit to regenerate the openapi spec" just a single line should be enough

you can also maybe add an additional mention that running the pre-commit locally before raising a pr ensures the ci passes with no unexpected failures

@jeeeeetshahhhhh

Copy link
Copy Markdown
Author

Addressed in 78d62e6. I moved the database-backend/schema-generation explanation into the existing CONTRIBUTING note, removed the duplicate manual command instructions, and added the requested guidance to run pre-commit after model/schema changes and locally before opening a PR.

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