Skip to content

Commit

Permalink
docs: correct required annotation for List API parameters (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-moxter authored Oct 8, 2021
1 parent 69cefb9 commit ba1bec9
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 37 deletions.
4 changes: 2 additions & 2 deletions internal/e2e/sdk_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ func (c *sdkClient) deleteTuple(t require.TestingT, r *relationtuple.InternalRel
func compileParams(q *relationtuple.RelationQuery, opts []x.PaginationOptionSetter) *read.GetRelationTuplesParams {
params := read.NewGetRelationTuplesParams().WithNamespace(q.Namespace)
if q.Relation != "" {
params = params.WithRelation(q.Relation)
params = params.WithRelation(&q.Relation)
}
if q.Object != "" {
params = params.WithObject(q.Object)
params = params.WithObject(&q.Object)
}
if q.SubjectID != nil {
params = params.WithSubjectID(q.SubjectID)
Expand Down
50 changes: 32 additions & 18 deletions internal/httpclient/client/read/get_relation_tuples_parameters.go

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

42 changes: 40 additions & 2 deletions internal/relationtuple/read_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,46 @@ func (h *handler) ListRelationTuples(ctx context.Context, req *acl.ListRelationT
// swagger:parameters getRelationTuples
// nolint:deadcode,unused
type getRelationsParams struct {
// swagger:allOf
queryRelationTuple
// Namespace of the Relation Tuple
//
// in: query
// required: true
Namespace string `json:"namespace"`

// Object of the Relation Tuple
//
// in: query
Object string `json:"object"`

// Relation of the Relation Tuple
//
// in: query
Relation string `json:"relation"`

// SubjectID of the Relation Tuple
//
// in: query
// Either subject_set.* or subject_id are required.
SubjectID string `json:"subject_id"`

// Namespace of the Subject Set
//
// in: query
// Either subject_set.* or subject_id are required.
SNamespace string `json:"subject_set.namespace"`

// Object of the Subject Set
//
// in: query
// Either subject_set.* or subject_id are required.
SObject string `json:"subject_set.object"`

// Relation of the Subject Set
//
// in: query
// Either subject_set.* or subject_id are required.
SRelation string `json:"subject_set.relation"`

// swagger:allOf
x.PaginationOptions
}
Expand Down
28 changes: 13 additions & 15 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,17 @@
"summary": "Query relation tuples",
"operationId": "getRelationTuples",
"parameters": [
{
"type": "string",
"name": "page_token",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"description": "Namespace of the Relation Tuple",
Expand All @@ -532,15 +543,13 @@
"type": "string",
"description": "Object of the Relation Tuple",
"name": "object",
"in": "query",
"required": true
"in": "query"
},
{
"type": "string",
"description": "Relation of the Relation Tuple",
"name": "relation",
"in": "query",
"required": true
"in": "query"
},
{
"type": "string",
Expand All @@ -565,17 +574,6 @@
"description": "Relation of the Subject Set",
"name": "subject_set.relation",
"in": "query"
},
{
"type": "string",
"name": "page_token",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"name": "page_size",
"in": "query"
}
],
"responses": {
Expand Down

0 comments on commit ba1bec9

Please sign in to comment.