This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Internal libraries

Shared first-party runtime libraries for this repository

This tree contains shared first-party runtime libraries used within this repository. All tracked content follows the repository’s public-source policy.

Each library owns its documentation, specifications and maintained changes under its component directory. A component used by only one project belongs in that project’s own internal directory.

  • Bazel targets MUST use repository-internal visibility.
  • Internal artifacts MUST NOT be independently published as product artifacts.
  • Internal targets MAY be used by production build targets and MAY be runtime dependencies of repository applications.

These libraries do not own separate product landing pages or release workflows. See the tools and third-party boundaries for developer tooling and externally maintained dependencies.

1 - X SDK

Go client generated from a checksum-pinned X API schema mirror

The SDK generates a Go client from the checksum-pinned X API schema mirror in third_party/com_x_api_openapi. Depend on //internal/x_sdk/pkg/client and import git.alwaldend.com/alwaldend/src/internal/x_sdk/pkg/client in Bazel-built Go code. The reusable OAuth 1.0a signer lives in pkg/oauth1; the Article uploader also uses it.

bazel build //internal/x_sdk:generate //internal/x_sdk/pkg/client
bazel test //internal/x_sdk/...

Bazel fetches the pinned schema anonymously from the versioned download mirror and caches it. Builds need no X credentials. Generation uses the pinned OpenAPI Generator and generator.json offline in a Bazel sandbox. Generated Go source stays under bazel-bin/internal/x_sdk/generate/; neither schema bytes nor generated client source are stored in Git. The upstream templates use the pinned gopkg.in/validator.v2 v2.0.1 dependency for union response decoding.

The schema dependency owns upstream refresh, mirror publication, provenance and checksum updates. Its maintenance command is implemented by tools/x_api_schema.

The schema’s supported authentication methods determine the generated client configuration. Its default server is X; override Configuration.Servers and Configuration.HTTPClient for local verification. OAuth 1.0a callers can use pkg/oauth1 to sign requests in an HTTP transport. OpenAPI Generator does not automatically sign the schema’s nonstandard HTTP OAuth security scheme. Response unions use the schema’s discriminator mappings, including Problem values in partial-success responses. The snapshot also contains discriminator paths that the generator warns about; streaming and unmapped polymorphic response decoding need endpoint-specific validation.

Three binary/base64 upload fields use handwritten json.RawMessage aliases selected through generator.json because the pinned generator emits invalid Go identifiers for those unions. Supply a base64 string encoded as a JSON string literal for JSON uploads. Other binary download and upload types retain the upstream generator’s defaults. Nogo excludes only the generator’s redundant named-result nil check in its generated client.go from the nilness analyzer; handwritten SDK code remains analyzed normally.