Skip to content

Commit

Permalink
add patch models
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbonnell committed Mar 25, 2021
1 parent 774425b commit ee2b8c4
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 9 deletions.
32 changes: 29 additions & 3 deletions client/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

package client

import "encoding/json"

// swagger:parameters createOAuth2Client
type swaggerCreateClientPayload struct {
// in: body
Expand All @@ -57,7 +55,35 @@ type swaggerPatchClientPayload struct {

// in: body
// required: true
Body json.RawMessage
Body patchRequest
}

// A JSONPatch request
//
// swagger:model patchRequest
type patchRequest []patchDocument

// A JSONPatch document as defined by RFC 6902
//
// swagger:model patchDocument
type patchDocument struct {
// The operation to be performed
//
// required: true
// example: "replace"
Op string `json:"op"`

// A JSON-pointer
//
// required: true
// example: "/name"
Path string `json:"path"`

// The value to be used within the operations
Value interface{} `json:"value"`

// A JSON-pointer
From string `json:"from"`
}

// swagger:parameters listOAuth2Clients
Expand Down

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

96 changes: 96 additions & 0 deletions internal/httpclient/models/patch_document.go

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

69 changes: 69 additions & 0 deletions internal/httpclient/models/patch_request.go

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

3 changes: 3 additions & 0 deletions internal/httpclient/models/plugin_config_interface.go

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

3 changes: 2 additions & 1 deletion internal/httpclient/models/volume.go

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

39 changes: 37 additions & 2 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
"in": "body",
"required": true,
"schema": {
"type": "object"
"$ref": "#/definitions/patchRequest"
}
}
],
Expand Down Expand Up @@ -2499,7 +2499,7 @@
}
},
"Scope": {
"description": "The level at which the volume exists. Either `global` for cluster-wide, or `local` for machine level.",
"description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.",
"type": "string"
},
"Status": {
Expand Down Expand Up @@ -3089,6 +3089,41 @@
}
}
},
"patchDocument": {
"description": "A JSONPatch document as defined by RFC 6902",
"type": "object",
"required": [
"op",
"path"
],
"properties": {
"from": {
"description": "A JSON-pointer",
"type": "string"
},
"op": {
"description": "The operation to be performed",
"type": "string",
"example": "\"replace\""
},
"path": {
"description": "A JSON-pointer",
"type": "string",
"example": "\"/name\""
},
"value": {
"description": "The value to be used within the operations",
"type": "object"
}
}
},
"patchRequest": {
"description": "A JSONPatch request",
"type": "array",
"items": {
"$ref": "#/definitions/patchDocument"
}
},
"rejectRequest": {
"type": "object",
"title": "The request payload used to accept a login or consent request.",
Expand Down

0 comments on commit ee2b8c4

Please sign in to comment.