Skip to content

Commit ce93fa3

Browse files
authored
Merge branch 'main' into dependabot/github_actions/peter-evans/create-pull-request-7
2 parents 55a4b94 + 384fcb5 commit ce93fa3

11 files changed

Lines changed: 15294 additions & 99 deletions

File tree

AGENTS.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository hosts the automatically generated **Affinity API v1** and **API
66

77
- **Primary doc (v1):** `docs/v1/affinity_api_docs.md` (auto-generated)
88
- **Primary doc (v2):** `docs/v2/affinity_api_docs.md` (auto-generated)
9+
- **OpenAPI spec (v2):** `docs/v2/openapi.json` (auto-generated)
910
- **Automation:** `tools/v1_sync_pipeline/` and `tools/v2_sync_pipeline/` (sync + QA tooling)
1011

1112
## Current Status
@@ -25,7 +26,7 @@ This repository hosts the automatically generated **Affinity API v1** and **API
2526
- **v1:** `python tools/v1_sync_pipeline/sync_v1_docs.py [--fail-on-diff]`
2627
- Reads https://api-docs.affinity.co/, writes `docs/v1/affinity_api_docs.md`, snapshot artifacts under `tmp/`
2728
- **v2:** `python tools/v2_sync_pipeline/sync_v2_docs.py [--fail-on-diff]`
28-
- Reads https://developer.affinity.co/, writes `docs/v2/affinity_api_docs.md`, HTML/state JSON/manifest saved under `tmp/v2/`
29+
- Reads https://developer.affinity.co/, writes `docs/v2/affinity_api_docs.md` and `docs/v2/openapi.json`, HTML/state JSON/manifest saved under `tmp/v2/`
2930
- Automatically extracts the embedded Redoc OpenAPI JSON, dereferences `$ref`s, flattens schemas, and injects schema + error appendices
3031
- `--fail-on-diff` mirrors the v1 behavior (exit 1 when the output differs from what is committed)
3132

@@ -41,7 +42,7 @@ This repository hosts the automatically generated **Affinity API v1** and **API
4142

4243
## Maintenance & Ownership
4344

44-
1. **Never edit** `docs/v1/affinity_api_docs.md` or `docs/v2/affinity_api_docs.md` manually. Regenerate via the sync scripts whenever updates are needed.
45+
1. **Never edit** `docs/v1/affinity_api_docs.md`, `docs/v2/affinity_api_docs.md`, or `docs/v2/openapi.json` manually. Regenerate via the sync scripts whenever updates are needed.
4546
2. **Quarterly BROKEN_ANCHOR_MAP review:** revisit `BROKEN_ANCHOR_MAP` inside `sync_v1_docs.py`, confirm the live site still requires the overrides, and track the reminder in the quarterly review issue (label `quarterly-review`).
4647
3. **Manual validation checklist (when investigating diffs):**
4748
- Run `python tools/v1_sync_pipeline/sync_v1_docs.py` and `python tools/v2_sync_pipeline/sync_v2_docs.py`
@@ -63,6 +64,7 @@ affinity-api-docs/
6364
│ │ └── affinity_api_docs.md # auto-generated canonical doc
6465
│ ├── v2/
6566
│ │ └── affinity_api_docs.md # auto-generated canonical doc
67+
│ │ └── openapi.json # auto-generated OpenAPI spec
6668
│ └── development/
6769
├── tools/
6870
│ └── v1_sync_pipeline/
@@ -91,6 +93,7 @@ affinity-api-docs/
9193
## Important Notes
9294

9395
- `docs/v1/affinity_api_docs.md` and `docs/v2/affinity_api_docs.md` are generated—**editing them manually will be reverted** the next time the pipelines run.
96+
- `docs/v2/openapi.json` is generated—**editing it manually will be reverted** the next time the v2 pipeline runs.
9497
- `docs/internal/` is gitignored on purpose—keep planning/rollout notes there locally without committing them.
9598
- The sync header clearly states the unofficial nature of this copy; always cross-check with https://api-docs.affinity.co/.
9699
- `llms.txt` spells out the guardrails for AI assistants—review it before delegating tasks to LLMs.

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
_No changes yet._
1111

12-
## [2.0.0] - 2025-11-10
12+
## [2.1.0] - 2025-12-14
13+
14+
### Added
15+
16+
- Stable Affinity API v2 OpenAPI spec artifact at `docs/v2/openapi.json` (auto-generated by `tools/v2_sync_pipeline/sync_v2_docs.py`).
17+
18+
### Fixed
19+
20+
- v2 markdown internal links now point to GitHub-compatible anchors (rewrites Redoc-style fragments during generation).
21+
- Updated broken API key help-center URL in the v2 markdown output.
22+
23+
## [2.0.0] - 2025-12-02
1324

1425
### Added
1526

@@ -25,6 +36,10 @@ _No changes yet._
2536
- v2 descriptions preserve embedded markdown tables, convert single-cell callout tables into blockquote warnings, and keep filter matrices/notes in sync with the live Redoc formatting.
2637
- Response schemas now include explicit model names, constraint-aware type strings, cleaner property tables, nested detail links, and a note explaining why live-site request/response samples are not mirrored in the markdown export.
2738

39+
### Removed
40+
41+
- Legacy `.github/scripts/check_and_update_docs.py` workflow helper in favor of the dedicated v1 and v2 sync pipeline scripts.
42+
2843
## [1.1.0] - 2025-11-10
2944

3045
### Added

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The original Affinity API documentation is hosted on dynamic, interactive websit
4646

4747
- 📄 [View on GitHub](https://github.com/yaniv-golan/affinity-api-docs/blob/main/docs/v2/affinity_api_docs.md)
4848
- 🔗 [Raw Markdown](https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v2/affinity_api_docs.md)
49+
- 🔗 [OpenAPI JSON](https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v2/openapi.json)
4950

5051
### Accessing Raw Markdown
5152

@@ -92,20 +93,20 @@ cd affinity-api-docs/docs/v1
9293
- ✅ Tag-based chapters, request/response tables, schema appendix, and error reference
9394
- ✅ Example `curl` requests synthesized for every endpoint
9495
- 📂 Location: `docs/v2/affinity_api_docs.md` (do **not** edit manually)
96+
- 📂 OpenAPI spec: `docs/v2/openapi.json` (do **not** edit manually)
9597

9698
## Automated Updates & Manual Workflow
9799

98100
### GitHub Actions
99101

100-
- **Sync Affinity v1 Docs** (`.github/workflows/check-docs-updates.yml`)
102+
- **Sync Affinity Docs** (`.github/workflows/check-docs-updates.yml`)
101103
- Runs daily at 00:00 UTC (plus manual `workflow_dispatch`)
102-
- Executes `python tools/v1_sync_pipeline/sync_v1_docs.py --fail-on-diff`
103-
- Runs `python tools/v1_sync_pipeline/qa/check_links.py docs/v1/affinity_api_docs.md`
104-
- Uses `peter-evans/create-pull-request` to open a PR whenever the canonical markdown changes
104+
- Executes both sync pipelines and link-checks the generated markdown
105+
- Uses `peter-evans/create-pull-request` to open a PR whenever the generated outputs change
105106
- **Tests** (`.github/workflows/tests.yml`)
106107
- Runs on push/PR
107108
- Re-runs the sync script with `--fail-on-diff` to ensure the repo already contains the generated output
108-
- Executes the pytest suite (coverage over `tools/v1_sync_pipeline`)
109+
- Executes the pytest suite (coverage over `tools/v1_sync_pipeline` and `tools/v2_sync_pipeline`)
109110

110111
### Manual Sync Steps
111112

@@ -161,7 +162,9 @@ affinity-api-docs/
161162
├── docs/
162163
│ ├── v1/ # API v1 documentation
163164
│ │ └── affinity_api_docs.md # Auto-generated canonical doc
164-
│ ├── v2/ # API v2 documentation (planned)
165+
│ ├── v2/ # API v2 documentation
166+
│ │ ├── affinity_api_docs.md # Auto-generated canonical doc
167+
│ │ └── openapi.json # Auto-generated OpenAPI spec
165168
│ └── development/ # Development documentation
166169
│ ├── TESTING.md # Testing guide
167170
│ └── TEST_RESULTS.md # Test results

REPOSITORY_STRUCTURE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ This document explains the repository structure and why files are organized this
3333

3434
**Why here?**: Development documentation belongs in `docs/`, separate from user-facing documentation.
3535

36+
### `docs/v1/` and `docs/v2/` - Generated Documentation Outputs
37+
38+
- **Purpose**: Houses generated artifacts that mirror the official Affinity API documentation.
39+
- **Key files**:
40+
- `docs/v1/affinity_api_docs.md` – generated by `tools/v1_sync_pipeline/sync_v1_docs.py`
41+
- `docs/v2/affinity_api_docs.md` – generated by `tools/v2_sync_pipeline/sync_v2_docs.py`
42+
- `docs/v2/openapi.json` – generated by `tools/v2_sync_pipeline/sync_v2_docs.py` (stable OpenAPI download)
43+
44+
**Why here?**: These are the canonical, committed outputs of the sync pipelines. They should never be edited manually.
45+
3646
### `tools/v1_sync_pipeline/` - Production Sync + QA Tooling
3747

3848
- **Purpose**: Houses the production-ready sync pipeline and QA scripts
@@ -43,6 +53,16 @@ This document explains the repository structure and why files are organized this
4353

4454
**Why here?**: Separates long-lived automation from discarded extraction experiments (`scripts/` directory has been removed).
4555

56+
### `tools/v2_sync_pipeline/` - Production v2 Sync Pipeline
57+
58+
- **Purpose**: Fetches the Redocly state payload from https://developer.affinity.co/ and generates the v2 markdown mirror + a stable OpenAPI JSON artifact.
59+
- **Contents**:
60+
- `sync_v2_docs.py` – Fetches Redoc shell HTML + state JS, extracts OpenAPI JSON, renders markdown, writes outputs under `docs/v2/`
61+
- `openapi_loader.py` – Discovers the `redocly-state-*.js` asset and extracts the embedded OpenAPI document
62+
- `markdown_renderer.py` – Converts the OpenAPI spec into readable markdown sections + appendices
63+
64+
**Why here?**: Keeps v2 automation co-located with v1, using the same “generated outputs, never hand-edit” approach.
65+
4666
### `requirements-ci.txt` - CI Dependencies
4767

4868
- **Purpose**: Python dependencies needed for CI/CD workflows
@@ -73,6 +93,7 @@ This document explains the repository structure and why files are organized this
7393
| Test docs | `docs/development/` | Development docs |
7494
| CI scripts | `.github/scripts/` | GitHub-specific (only `validate_docs_structure.py` remains) |
7595
| Sync pipeline | `tools/v1_sync_pipeline/` | Production automation + QA helpers |
96+
| Sync pipeline (v2) | `tools/v2_sync_pipeline/` | Production automation for v2 docs |
7697
| Workflows | `.github/workflows/` | GitHub Actions |
7798
| Requirements | `requirements-ci.txt` | Root level, CI-specific |
7899
| Metadata | `.github/docs-version-*.json` | Workflow state |

0 commit comments

Comments
 (0)