Skip to content

Commit a49c659

Browse files
committed
feat: Add OpenAPI/Swagger documentation
- Install swaggo dependencies for Swagger/OpenAPI generation - Add comprehensive API annotations to all endpoints - Refactor API handlers into named functions for better documentation - Extract ActionEntity and EvaluationResponseContext as named types - Add Swagger UI endpoint at /swagger/index.html - Generate OpenAPI 2.0 specification (swagger.yaml, swagger.json) - Add Makefile targets for swagger generation - Document all endpoints: /health, /ready, /status, /info, /authzen/decision, /metrics - Add API metadata: title, description, contact, license, tags OpenAPI spec available at docs/swagger/ Swagger UI accessible at http://localhost:6001/swagger/index.html Addresses Phase 4 Task #1: OpenAPI/Swagger documentation Co-authored-by: GitHub Copilot
1 parent 39a8889 commit a49c659

File tree

16 files changed

+1556
-315
lines changed

16 files changed

+1556
-315
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ jobs:
136136
137137
echo "Files in .badges/main before copy:"
138138
ls -la .badges/main/ || echo "Directory doesn't exist"
139-
140-
# Copy the generated badge files from temp
139+
140+
# Copy the generated badge files from temp
141141
mkdir -p .badges/main
142142
cp -v /tmp/badges/*.svg .badges/main/
143143
echo "Badges copied to badges branch:"

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,20 @@ test-all: test test-integration ## run all tests including integration tests
5959
build: check-go-version ## build the library
6060
CGO_ENABLED=1 go build ${LDFLAGS} -trimpath -o gt -a ./cmd/main.go
6161

62+
.PHONY: swagger
63+
swagger: install-swag ## Generate OpenAPI/Swagger documentation
64+
$(GOBIN)/swag init -g main.go --output docs/swagger --parseDependency --parseInternal 2>&1 | grep -v "warning: failed to evaluate" || true
65+
@echo "Swagger documentation generated at docs/swagger/"
66+
@echo "View at: http://localhost:6001/swagger/index.html (when server is running)"
67+
68+
.PHONY: install-swag
69+
install-swag: ## Install swag tool for generating Swagger docs
70+
@which swag > /dev/null || (echo "Installing swag..." && go install github.com/swaggo/swag/cmd/swag@latest)
71+
6272
.PHONY: clean
6373
clean: ## remove temporary files
6474
go clean
75+
rm -rf docs/swagger
6576

6677
.PHONY: deps
6778
deps: ## Update dependencies

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
Go-Trust is a local trust engine that provides trust decisions based on ETSI TS 119612 Trust Status Lists (TSLs). It allows clients to abstract trust decisions through an AuthZEN policy decision point (PDP). The service evaluates trust in subjects identified by X509 certificates using a set of TSLs.
2424

25-
Go-Trust is not meant to be used cross trust boundaries. The reason for creating Go-Trust is to promote interoperability across implementations that rely on ETSI trust status lists such as the EUDI wallet. ETSI TS 119 612 is complex to implement correctly and hopefully Go-Trust provides a way to both ensure correct trust evaluation as well as provide performance enhancements by allowing for local caching etc. Go-Trust is an API service meant to be run inside the same trust domain as the entity that relies on trust evaluation (for instance a wallet unit or an issuer).
25+
Go-Trust is not meant to be used across trust boundaries. The reason for creating Go-Trust is to promote interoperability across implementations that rely on ETSI trust status lists such as the EUDI wallet. ETSI TS 119 612 is complex to implement correctly and hopefully Go-Trust provides a way to both ensure correct trust evaluation as well as provide performance enhancements by allowing for local caching etc. Go-Trust is an API service meant to be run inside the same trust domain as the entity that relies on trust evaluation (for instance a wallet unit or an issuer).
2626

2727
Go-Trust can also be used to maintain and publish ETSI trust status lists, act as a local distribution point and provide policy based transformation of trust status lists.
2828

0 commit comments

Comments
 (0)