Skip to content

Commit dd31c23

Browse files
committed
doc: doc cleanup before v2.3
Signed-off-by: Frederic BIDON <[email protected]>
1 parent f6b39fc commit dd31c23

File tree

13 files changed

+203
-90
lines changed

13 files changed

+203
-90
lines changed

.mdsf.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/hougesen/mdsf/main/schemas/v0.11.1/mdsf.schema.json",
3+
"format_finished_document": false,
4+
"languages": {
5+
"go": "golangci-lint:fmt",
6+
"shell": "shfmt"
7+
},
8+
"language_aliases": {
9+
"sh": "shell",
10+
"cmd": "shell",
11+
"bash": "shell"
12+
}
13+
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ thus reducing their dependencies footprint.
122122

123123
Go-swagger will be adapted over Q1 2026.
124124

125-
Features will probably be added to support our main use cases there.
125+
Features will be added to support our main use cases there.
126126

127127
## Change log
128128

@@ -144,6 +144,7 @@ distributed with this fork, including internalized libraries.
144144
* [Motivations](https://go-openapi.github.io/testify/project/readme)
145145
* [Roadmap][doc-roadmap]
146146
* [Internal architecture](https://go-openapi.github.io/testify/project/maintainers/architecture)
147+
* [Benchmarks](https://go-openapi.github.io/testify/project/maintainers/benchmarks)
147148

148149
* [All-time contributors](./CONTRIBUTORS.md)
149150
* [Contributing guidelines](https://go-openapi.github.io/testify/project/contributing/)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This policy outlines the commitment and practices of the go-openapi maintainers
66

77
| Version | Supported |
88
| ------- | ------------------ |
9-
| 2.1.x | :white_check_mark: |
9+
| 2.2.x | :white_check_mark: |
1010

1111
## Vulnerability checks in place
1212

docs/doc-site/_index.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,11 @@ This is the go-openapi fork of the great [testify](https://github.com/stretchr/t
2020
{{% button href="https://github.com/go-openapi/testify/fork" hint="fork me on github" style=primary icon=code-fork %}}Fork me{{% /button %}}
2121
Design and exploration phase. Feedback, contributions and proposals are welcome.
2222

23-
### Motivation
24-
25-
From the maintainers of `testify`, it looks like a v2 will eventually be released, but they'll do it at their own pace.
26-
27-
We like all the principles they exposed to build this v2. [See discussion about v2](https://github.com/stretchr/testify/discussions/1560).
28-
29-
However, at `go-openapi` we would like to address the well-known issues in `testify` with different priorities.
30-
31-
With this fork, we want to:
32-
1. [x] remove all external dependencies.
33-
2. [x] make it easy to maintain and extend.
34-
3. [x] pare down some of the chrome that has been added over the years.
23+
See our [ROADMAP](./maintainers/ROADMAP.md).
3524

36-
{{% notice style="primary" title="Extended hand" icon="hand" %}}
37-
We hope that this endeavor will help the original project with a live-drill of what a v2 could look like.
38-
39-
Hopefully, some of our ideas will eventually percolate back into the original project and help the wider
40-
community of go developers write better, clearer test code.
41-
42-
Feedback is welcome and we are always happy to discuss with people who face the same problems as we do: avoid breaking changes,
43-
APIs that became bloated over a decade or so, uncontrolled dependencies, difficult choices when it comes to introduce
44-
breaking changes, conflicting demands from users etc.
45-
{{% /notice %}}
25+
### Motivation
4626

47-
Find more about our motivations in the project's [README](README.md#motivation).
48-
You might also be curious about our [ROADMAP](project/maintainers/ROADMAP.md).
27+
See [why we wanted a v2](./MOTIVATION.md).
4928

5029
### Getting started
5130

@@ -179,6 +158,7 @@ See also our [CONTRIBUTING guidelines](./project/contributing/CONTRIBUTING.md).
179158
- [Generics Guide](./usage/GENERICS.md) - Type-safe assertions with 38 generic functions
180159
- [Migration Guide](./usage/MIGRATION.md) - Migrating from stretchr/testify v1
181160
- [Changes from v1](./usage/CHANGES.md) - All changes and improvements in v2
161+
- [Benchmarks](./project/maintainers/benchmarks.md) - Performance improvements in v2
182162

183163
**Reference:**
184164
- [API Reference](./api/_index.md) - Complete assertion catalog organized by domain
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Motivation
3+
description: Motivations for this fork
4+
weight: 5
5+
---
6+
7+
From the maintainers of `testify`, it looks like a v2 will eventually be released, but they'll do it at their own pace.
8+
9+
We like all the principles they exposed to build this v2. [See discussion about v2](https://github.com/stretchr/testify/discussions/1560).
10+
11+
However, at `go-openapi` we would like to address the well-known issues in `testify` with different priorities.
12+
13+
With this fork, we want to:
14+
15+
1. [x] remove all external dependencies.
16+
2. [x] make it easy to maintain and extend.
17+
3. [x] pare down some of the chrome that has been added over the years.
18+
19+
---
20+
21+
{{% notice style="primary" title="Extended hand" icon="hand" %}}
22+
We hope that this endeavor will help the original project with a live-drill of what a v2 could look like.
23+
24+
Hopefully, some of our ideas will eventually percolate back into the original project and help the wider
25+
community of go developers write better, clearer test code.
26+
27+
Feedback is welcome and we are always happy to discuss with people who face the same problems as we do: avoid breaking changes,
28+
APIs that became bloated over a decade or so, uncontrolled dependencies, difficult choices when it comes to introduce
29+
breaking changes, conflicting demands from users etc.
30+
{{% /notice %}}
31+
32+
You might also be curious about our [ROADMAP](project/maintainers/ROADMAP.md).
33+
34+
---
35+
36+
1. We wanted first to remove all external dependencies.
37+
38+
> For all our libraries and generated test code we don't want test dependencies
39+
> to drill farther than `import github.com/go-openapi/testify/v2`, but on some specific (and controlled)
40+
> occasions.
41+
>
42+
> In this fork, all external stuff is either internalized (`go-spew`, `difflib`),
43+
> removed (`mocks`, `suite`, `http`) or specifically enabled by importing this module
44+
> (`github.com/go-openapi/testify/enable/yaml/v2`).
45+
46+
2. Make it easy to maintain and extend.
47+
48+
> For go-openapi, testify should just be yet another part of our toolkit.
49+
> We need it to work, be easily adaptable to our needs and not divert our development effort away from our other repos.
50+
> This big refactor is an investment.
51+
52+
3. We want to pare down some of the chrome that has been added over the years
53+
54+
> The `go-openapi` libraries and the `go-swagger` project make a rather limited use of the vast API provided by `testify`.
55+
>
56+
> With this first version of the fork, we have removed `mocks` and `suite`, which we don't use.
57+
> They might be added later on, with better controlled dependencies.
58+
>
59+
> In the forthcoming maintenance of this fork, much of the "chrome" or "ambiguous" API will be pared down.
60+
> There is no commitment yet on the stability of the API.
61+
>
62+
> Chrome would be added later: we have the "enable" packages just for that for when external dependencies are needed.
63+
64+
4. We want to add new features like generics, more useful assertions for JSON and safety checks.
65+
66+
5. We want to get rid of the API quirks and gotchas that panic or return unexpected results.

docs/doc-site/project/README.md

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,21 @@
11
---
22
title: README
33
description: |
4-
Introducing `go-openapi/testify/v2`.
4+
Introducing go-openapi/testify/v2.
55
66
- Approach
77
- Main features
88
- Differences with v1
9-
weight: 1
9+
weight: 2
1010
---
1111

12-
**Go testing assertions for the rest of us**
12+
**The v2 our tests wanted**
1313

1414
## Motivation
1515

16-
1. We want first to remove all external dependencies.
16+
See [why we wanted a v2](./MOTIVATION.md).
1717

18-
> For all our libraries and generated test code we don't want test dependencies
19-
> to drill farther than `import github.com/go-openapi/testify/v2`, but on some specific (and controlled)
20-
> occasions.
21-
>
22-
> In this fork, all external stuff is either internalized (`go-spew`, `difflib`),
23-
> removed (`mocks`, `suite`, `http`) or specifically enabled by importing this module
24-
> (`github.com/go-openapi/testify/enable/yaml/v2`).
25-
26-
2. Make it easy to maintain and extend.
27-
28-
> For go-openapi, testify should just be yet another part of our toolkit.
29-
> We need it to work, be easily adaptable to our needs and not divert our development effort away from our other repos.
30-
> This big refactor is an investment that has to pay off.
31-
32-
3. We want to pare down some of the chrome that has been added over the years
33-
34-
> The `go-openapi` libraries and the `go-swagger` project make a rather limited use of the vast API provided by `testify`.
35-
>
36-
> With this first version of the fork, we have removed `mocks` and `suite`, which we don't use.
37-
> They might be added later on, with better controlled dependencies.
38-
>
39-
> In the forthcoming maintenance of this fork, much of the "chrome" or "ambiguous" API will be pared down.
40-
> There is no commitment yet on the stability of the API.
41-
>
42-
> Chrome would be added later: we have the "enable" packages just for that.
43-
44-
4. We hope that this endeavor will help the original project with a live-drill of what a v2 could look like.
45-
We are always happy to discuss with people who face the same problems as we do: avoid breaking changes,
46-
APIs that became bloated over a decade or so, uncontrolled dependencies, conflicting demands from users etc.
47-
48-
### The approach with this fork
18+
### Approach with this fork
4919

5020
This fork targets **go1.24**.
5121

docs/doc-site/project/SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Security Policy
33
description: |
44
This document outlines the commitment and practices of the go-openapi maintainers regarding security
5-
weight: 2
5+
weight: 3
66
---
77

88
This policy outlines the commitment and practices of the go-openapi maintainers regarding security.
@@ -11,7 +11,7 @@ This policy outlines the commitment and practices of the go-openapi maintainers
1111

1212
| Version | Supported |
1313
| ------- | ------------------ |
14-
| 2.1.x | :white_check_mark: |
14+
| 2.2.x | :white_check_mark: |
1515

1616
## Vulnerability checks in place
1717

docs/doc-site/project/maintainers/ARCHITECTURE.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,65 @@ description: Project structure
44
weight: 2
55
---
66

7+
## Primer
8+
9+
### Goals
10+
11+
We want the maintainance of dozens of test assertions, times many variants, to remain reasonably low.
12+
13+
The maintainance flow is intended to require different activities and levels of understanding,
14+
dependending on the complexity of a planned evolution.
15+
16+
{{< mermaid align="center" zoom="true" >}}
17+
journey
18+
section Fixes & minor enhancements
19+
internal/assertions:5: Knowledge of the functionality
20+
section New dependencies
21+
internal/assertions/enable/...:5: Understanding of the repo architecture
22+
enable/...:5: Understanding of the repo architecture
23+
section API changes
24+
regenerate code:5: No specific knowledge
25+
section New constructs to support
26+
code & doc generator:5: Knowledge of internals
27+
{{< /mermaid >}}
28+
29+
Fixes and enhancements propagate naturally to the variants without the need to regenerate code.
30+
31+
### The maths with assertion variants
32+
33+
Each test assertion produces 2 base variants (assert, require).
34+
35+
Each of these variants produces another formatted variant. Except for generic assertions, we produce
36+
one "forward" variant and one "forward formatted" variant (as methods).
37+
38+
**For every non-generic assertion: 8 variants.**
39+
40+
**For every generic assertion: 4 variants.**
41+
42+
**For every "helper" function (not an assertion): 2 variants.**
43+
44+
45+
All these variants make up several hundreds functions, which poses a challenge for maintainance and documentation.
46+
47+
We have adopted code and documentation generation as a mean to mitigate this issue.
48+
49+
#### Current (v2.2.0)
50+
51+
1. Generic assertions (with type parameters): 38 functions
52+
2. Non-generic assertions (with t T parameter, no type parameters): 82 functions
53+
3. Helper functions (no t T parameter): 4 functions
54+
55+
Total: 124 functions to _maintain_
56+
57+
**Generated Functions**
58+
59+
1. Generic assertions: 152
60+
2. Non-generic assertions: 656
61+
3. Helper functions: 8
62+
4. Constructors: 2
63+
64+
Total: 818 functions
65+
766
## Architecture Overview
867

968
{{< mermaid align="center" zoom="true" >}}
@@ -31,7 +90,6 @@ All assertion implementations live in `internal/assertions/`, organized by domai
3190
**Code Generator: `codegen/`**
3291

3392
The generator scans `internal/assertions/` and produces:
34-
- n assertion functions × 8 variants = 608 generated functions (current: n=76)
3593
- Package-level functions (`assert.Equal`, `require.Equal`)
3694
- Format variants (`assert.Equalf`, `require.Equalf`)
3795
- Forward methods (`a.Equal()`, `r.Equal()`)
@@ -41,6 +99,8 @@ The generator scans `internal/assertions/` and produces:
4199

42100
**Generated Packages: `assert/` and `require/`**
43101

102+
The generated functions directly call the internal implementation: no code duplication or change in semantics.
103+
44104
**Generated Documentation: `docs/doc-site/api/`**
45105

46106
Everything in these packages is generated. Never edit generated files directly.
@@ -57,3 +117,7 @@ The `enable/` package provides optional features that users can activate via bla
57117
- `enable/colors/` - Activates colorized output via `import _ "github.com/go-openapi/testify/v2/enable/colors"`
58118

59119
These packages are not generated and allow optional dependencies to be isolated from the core library.
120+
121+
## See Also
122+
123+
- [Code generation](./CODEGEN.md) - Detailed view of our code and doc generator

docs/doc-site/project/maintainers/CODEGEN.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This repository uses code generation extensively to maintain consistency across
7777
style not_generated_require fill:#4a9eff,color:#fff
7878
{{< /mermaid >}}
7979

80-
> The generator scans source code, extracts metadata, builds a model, and applies templates to generate ~600+ functions, tests, and documentation from ~70-80+ source functions.
80+
> The generator scans source code, extracts metadata, builds a model, and applies templates to generate ~800+ functions, tests, and documentation from ~100+ source functions.
8181
8282
---
8383

@@ -158,7 +158,9 @@ graph TD
158158
style require_group fill:#ffb6c1,color:#000
159159
{{< /mermaid >}}
160160

161-
> **76 functions × 8 variants = 608 generated functions** (plus tests and documentation for each)
161+
> **reflection-based assertions become 8, generic assertions become 4**
162+
>
163+
> (plus tests and documentation for each).
162164
163165
---
164166

0 commit comments

Comments
 (0)