You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: enhance configuration and documentation for Fabrica project
- Updated FabricaConfig structure to include detailed comments on configuration options.
- Deprecated versioning configuration in FabricaConfig; moved to apis.yaml.
- Added readAPIsConfig function to load apis.yaml for versioning.
- Modified generate command to support resource discovery from apis.yaml.
- Improved init command to create apis.yaml alongside .fabrica.yaml during project initialization.
- Added comprehensive documentation for apis.yaml structure and usage.
- Updated versioning command to work with the new apis.yaml format.
- Adjusted generator defaults to disable versioning by default.
Signed-off-by: Alex Lovell-Troy <alovelltroy@lanl.gov>
Copy file name to clipboardExpand all lines: README.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,15 @@ SPDX-License-Identifier: MIT
19
19
> **🏗️ Code Generator for Go REST APIs**
20
20
> Transform Go structs into production-ready REST APIs with OpenAPI specs, storage backends, and middleware in minutes.
21
21
22
+
## 📚 Documentation & Resources
23
+
24
+
| Resource | Description |
25
+
|----------|-------------|
26
+
|**[Full Documentation](https://openchami.github.io/fabrica/)**| Complete guides, tutorials, and best practices |
27
+
|**[API Reference (GoDoc)](https://pkg.go.dev/github.com/openchami/fabrica)**| Comprehensive Go package documentation |
28
+
|**[Getting Started Guide](docs/guides/getting-started.md)**| Step-by-step introduction to Fabrica |
29
+
|**[Examples](examples/)**| Hands-on learning with real-world projects |
30
+
22
31
Fabrica is a powerful code generation tool that accelerates API development by transforming simple Go struct definitions into complete, production-ready REST APIs. Define your resources once, and Fabrica generates everything you need: handlers, storage layers, clients, validation, OpenAPI documentation, and more.
23
32
24
33
## ✨ Key Features
@@ -117,7 +126,7 @@ type DeviceStatus struct {
117
126
fabrica generate
118
127
```
119
128
120
-
This generates handlers, storage, and client code. By default, APIs expose `<group>/v1`. To add multiple versions (`v1alpha1`, `v1beta1`, etc.), create an `apis.yaml` file (see [Hub/Spoke Versioning Guide](docs/versioning.md)).
129
+
This generates handlers, storage, and client code. By default, APIs expose `<group>/v1`. Your project includes a root-level `apis.yaml` file defining API groups and versions (see [Hub/Spoke Versioning Guide](docs/versioning.md)). To add more versions, run `fabrica add version <new-version>`.
121
130
122
131
**5. Update dependencies:**
123
132
@@ -304,25 +313,32 @@ type DeviceStatus struct {
304
313
> **💡 Pro Tip:** Focus on designing your `spec` and `status` structs - Fabrica handles all the envelope complexity automatically!
305
314
306
315
307
-
## 📖 Documentation
316
+
## 📖 In-Depth Documentation
308
317
309
-
**🚀 Getting Started:**
318
+
**🚀 Quick Learning:**
310
319
-[Complete Getting Started Guide](docs/guides/getting-started.md) - Step-by-step tutorial
returnfmt.Errorf("versioning is enabled but features.versioning.group is not set in .fabrica.yaml.\nPlease set the API group (e.g., 'infra.example.io') in your configuration")
112
+
apisConfig, err:=LoadAPIsConfig("")
113
+
iferr!=nil {
114
+
ifos.IsNotExist(err) {
115
+
returnfmt.Errorf("apis.yaml not found; run 'fabrica init' to create it")
122
116
}
117
+
returnfmt.Errorf("failed to load apis.yaml: %w", err)
118
+
}
123
119
124
-
// Version is required for versioned projects
125
-
ifopts.version=="" {
126
-
// Auto-select storage version (hub) if no version specified
fmt.Printf("No version specified, using storage hub version: %s\n", opts.version)
130
-
} else {
131
-
returnfmt.Errorf("no --version specified and no storage_version configured.\nPlease specify a version with --version or set features.versioning.storage_version in .fabrica.yaml")
0 commit comments