Skip to content

feat: refactor documentation AR-8#446

Merged
Minister944 merged 4 commits into
mainfrom
AR-8-llm-skills-and-documentation
Jul 21, 2026
Merged

feat: refactor documentation AR-8#446
Minister944 merged 4 commits into
mainfrom
AR-8-llm-skills-and-documentation

Conversation

@Minister944

Copy link
Copy Markdown
Contributor

Restructures the docs from a flat, README-derived layout into a categorized Docusaurus site, and slims README.md into a landing page. Content was split out of the README, then expanded and corrected against the source code - several settings and behaviours were missing or stale.

New docs/ structure:

  • docs/
    • 01-introduction.md
    • 02-guides/ step-by-step, schema sources, using the client, subscriptions, file uploads, custom scalars, extending types, multiple clients, OpenTelemetry, async vs sync, schema generation, custom operations
    • 03-reference/ configuration, generated code dependencies
    • 04-plugins/ (renamed from 06-plugins; contents unchanged)
    • 05-community/ contributing, versioning policy

Split the flat docs/ files into guides/reference/plugins/community
sections with proper sidebar categories, add missing guide pages
(schema sources, subscriptions, file uploads, custom scalars,
extending types, multiple clients, OpenTelemetry, async vs sync,
schema generation), and slim README.md down to a feature overview
that links out to the new docs site instead of duplicating content.
…gration

Relative links inside docs/ still pointed at the old docs/... paths, em
dashes rendered inconsistently, and a few pages were missing recently
added settings (remote_schema_http_client_path, introspection_*,
opentelemetry-api dependency).
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e839666e-5116-4e27-a631-9a4fd72fdcd2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AR-8-llm-skills-and-documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread docs/01-introduction.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't able to set this int reference for the readme, so here's a copy-paste

Comment thread EXAMPLE.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do we need this file?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

leave it for now

Comment thread docs/02-guides/02-schema-sources.md Outdated
Comment thread docs/02-guides/02-schema-sources.md
Comment thread docs/02-guides/02-schema-sources.md Outdated
Comment thread docs/02-guides/02-schema-sources.md Outdated
Comment thread docs/02-guides/03-using-generated-client.md
Comment thread docs/02-guides/11-schema-generation.md Outdated
Comment thread docs/02-guides/12-custom-operation-builder.md Outdated
Comment thread docs/02-guides/12-custom-operation-builder.md Outdated
Comment thread docs/03-reference/01-configuration.md Outdated
Comment thread README.md Outdated
Minister944 and others added 2 commits July 14, 2026 16:06
Co-authored-by: Aleksander Spyra <aleksander.spyra@mirumee.com>
- schema-sources: document directory extension behavior; reframe schema_paths
  around combining multiple files (installed packages as secondary use case)
- using-generated-client: add basic init example, drop redundant headers heading,
  move context-manager section before configuration, split advanced HTTP config
  into httpx vs custom-client sections, fix non-httpx client claims
- subscriptions: drop redundant client-configuration link
- extending-types: clarify files_to_include is required for relative mixin imports
- opentelemetry: link opentelemetry-api to PyPI
- async-vs-sync: drop duplicated setting bullet and sections repeating the client guide
- schema-generation: bulletize schema-source options, link process_schema hook
- custom-operation-builder: fold Enabling into intro, rename example sections
- configuration: restore original remote_schema_http_client_path description
- README: link Contributing directly to CONTRIBUTING.md
@Minister944
Minister944 requested a review from Kwaidan00 July 14, 2026 15:30
@Minister944
Minister944 merged commit f7d1f2b into main Jul 21, 2026
6 checks passed
@Minister944
Minister944 deleted the AR-8-llm-skills-and-documentation branch July 21, 2026 12:40
DamianCzajkowski added a commit that referenced this pull request Jul 21, 2026
The use_alias_generator branch predates the docs-site refactor (#446), so it
added these two guides as flat docs/07 and docs/08 pages and linked them from a
monolithic README. Move them under docs/02-guides/ to match the current
structure and repoint the config-reference links.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
DamianCzajkowski added a commit that referenced this pull request Jul 21, 2026
The use_alias_generator branch predates the docs-site refactor (#446), so it
added these two guides as flat docs/07 and docs/08 pages and linked them from a
monolithic README. Move them under docs/02-guides/ to match the current
structure and repoint the config-reference links.
DamianCzajkowski added a commit that referenced this pull request Jul 22, 2026
* feat: add use_alias_generator setting

* fix: don't silently ship wrong aliases or unformatted code

* fix: keep fragment forward references resolvable in operation modules

A generated client whose operation spreads a fragment could not be imported
on Python 3.10, with or without `defer_model_build`:

    PydanticUndefinedAnnotation: name 'UserFieldsFriends' is not defined

A fragment names its nested selections by forward reference, and an operation
that spreads it subclasses the fragment class from another module:

    # fragments.py
    class UserFields(BaseModel):
        friends: list["UserFieldsFriends"]

    # list_users.py
    class ListUsersUsers(UserFields):
        pass

Pydantic resolves the annotations a subclass inherits against the subclass's
own module, and `UserFieldsFriends` lives in `fragments`. On 3.11+ the
inherited `ForwardRef` evaluation is reused and this happens to work; on 3.10
it is re-evaluated and fails. `requires-python` is `>= 3.10` and the default
hatch environment pins 3.10, so this failed on the version CI runs.

With `defer_model_build` the same shape failed on every supported version,
because dropping the eager `model_rebuild()` calls removes the only thing
that ever resolved those references.

Emit the names the mixin bases need into the module that has to resolve them:

    from .fragments import (
        UserFields,
        UserFieldsFriends,  # noqa: F401
    )

The `noqa` is required because the name appears only inside an inherited
annotation. Keeping the build deferred rather than restoring the eager
fragment rebuilds preserves the whole import-time win - `defer_model_build`
now measures 1.79x faster to import on a 1448-type schema, against 1.74x
before, because no fragment models are built at import.

Add `ForwardRefNamesVisitor` and `collect_class_forward_ref_names()` in
`codegen.py`; `_map_fragment_forward_refs()` and `_mixin_forward_ref_import()`
in `package.py`. `ast.unparse` drops comments, so the line is injected as raw
source through the new `prepend_code` argument of `_queue_module`. Clients
with no fragment mixin are byte-for-byte unchanged.

The suite never caught this because every `expected_client` fixture is inert:
the tests diff generated source and never import it. Add two tests that
import a generated package and validate a payload, one per path. Both fail
only on Python 3.10, which the default hatch environment provides.

* docs: record graphql-core dependency and the two import-performance settings

`enable_custom_operations` makes the generated `base_operation.py` and
`client.py` import graphql-core to build and print a query AST at runtime, so
the generated package needs it alongside pydantic and httpx. It was missing
from "Generated code dependencies" and costs roughly 25 ms of import.

`defer_model_build` and `use_alias_generator` were documented in the README
but absent from the optional-settings list in `docs/02-configuration.md`,
where every other setting lives.

Also describe the `# noqa: F401` fragment import that generated operation
modules now carry, so it does not read as a code-generation bug to anyone
running a linter over the output.

* test: cover alias_generator in the multipart_uploads=false base-model test

Now that use_alias_generator exists, extend the no-upload base-model config test
to also enable it and assert alias_generator=to_camel lands on the generated
BaseModel - exercising the base-model source-path detection for all three
config rewrites in the uploads-disabled path.

* build: require pydantic >=2.8 for use_alias_generator

`use_alias_generator` sets `alias_generator=to_camel` and omits the explicit
`Field(alias=...)` for fields whose GraphQL name `to_camel` can reconstruct.
`to_camel`'s case handling was fixed in pydantic 2.8 (pydantic/pydantic#9561);
on earlier versions it could mangle names, so the generated package would
rebuild the wrong aliases. Raise the floor to 2.8 to match.

* docs: tighten the to_camel / pydantic 2.8 floor comments

* docs: move import-performance and fragments docs out of README

* fix: don't let the BaseModel config rewrite go missing unnoticed

* docs: drop the defer_model_build aside from the fragments page

* test: consolidate the rewrite_base_model config tests

* docs: place the import-performance and fragments guides in the docs site

The use_alias_generator branch predates the docs-site refactor (#446), so it
added these two guides as flat docs/07 and docs/08 pages and linked them from a
monolithic README. Move them under docs/02-guides/ to match the current
structure and repoint the config-reference links.

* fix: satisfy ty 0.0.62 in extract_operations and shorter_results

ty 0.0.62 (stricter than the version CI ran previously) flags two spots in
existing contrib plugins: the `ast.Constant.value` union widens the list
passed to `sorted()` past `SupportsRichComparison`, and `ImportFrom.module`
is `str | None` so indexing the `dict[str, set]` of extended imports with it
is rejected. Narrow the constant to `str` and bind/guard the module name.
No behaviour change.
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.

3 participants