Skip to content

Commit

Permalink
Merge pull request #15 from nuts-foundation/add-variable-path-segment…
Browse files Browse the repository at this point in the history
…s-to-API

Add variable length path segments to API
  • Loading branch information
gerardsn authored Sep 5, 2024
2 parents a7e9098 + bf106f6 commit 77f61d4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
4 changes: 2 additions & 2 deletions api/opa/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Wrapper struct {
DecisionMaker policy.DecisionMaker
}

func (w Wrapper) EvaluateDocumentApisix(ctx context.Context, request EvaluateDocumentApisixRequestObject) (EvaluateDocumentApisixResponseObject, error) {
func (w Wrapper) EvaluateDocumentWildcardPolicy(ctx context.Context, request EvaluateDocumentWildcardPolicyRequestObject) (EvaluateDocumentWildcardPolicyResponseObject, error) {
if request.Body == nil {
return nil, errors.New("missing body")
}
Expand Down Expand Up @@ -62,7 +62,7 @@ func (w Wrapper) EvaluateDocumentApisix(ctx context.Context, request EvaluateDoc
// "allow": true
// }
//}
return EvaluateDocumentApisix200JSONResponse(*outcome), nil
return EvaluateDocumentWildcardPolicy200JSONResponse(*outcome), nil
}

func (w Wrapper) EvaluateDocument(ctx context.Context, request EvaluateDocumentRequestObject) (EvaluateDocumentResponseObject, error) {
Expand Down
48 changes: 24 additions & 24 deletions api/opa/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions oas/opa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Outcome'
/v1/data/apisix:
/v1/data/*:
post:
operationId: evaluateDocumentApisix
operationId: evaluateDocumentWildcardPolicy
summary: calls https://www.openpolicyagent.org/docs/latest/rest-api/#get-a-document-with-input internally
description: |
The given request and X-Userinfo headers are used to create the input document for the OPA policy.
The wildcard contains path elements normally used to select an OPA policy.
This API ignores the wildcard (policy) and does the same thing as /v1/data (select policy based on scope).
tags:
- opa
requestBody:
Expand Down

0 comments on commit 77f61d4

Please sign in to comment.