Merge pull request #51666 from ndeloof/swagger

simplify swagger generation
This commit is contained in:
Brian Goff
2025-12-15 08:13:20 -08:00
committed by GitHub
4 changed files with 52 additions and 70 deletions

View File

@@ -17,16 +17,6 @@ generate_model() {
$(printf -- '--name=%s ' "${MAPFILE[@]}")
}
generate_operation() {
mapfile
swagger generate operation --spec="${API_DIR}/swagger.yaml" \
--target="${API_DIR}" --api-package=types --model-package=types \
--config-file="${API_DIR}/swagger-gen.yaml" \
--template-dir="${API_DIR}/templates" --allow-template-override \
"$@" \
$(printf -- '--name=%s ' "${MAPFILE[@]}")
}
# /==================================================================\
# | |
# | ATTENTION: |
@@ -63,6 +53,7 @@ EOT
generate_model types/image <<- 'EOT'
ImageDeleteResponseItem
ImagesDiskUsage
ImageHistoryResponseItem
EOT
# ImageSummary
# TODO: Restore when go-swagger is updated
@@ -116,12 +107,3 @@ generate_model types/volume <<- 'EOT'
EOT
#endregion
#region -------- Operations --------
generate_operation --skip-responses --skip-parameters <<- 'EOT'
Authenticate
ImageHistory
EOT
#endregion

View File

@@ -172,6 +172,34 @@ tags:
x-displayName: "System"
definitions:
ImageHistoryResponseItem:
type: "object"
x-go-name: HistoryResponseItem
title: "HistoryResponseItem"
description: "individual image layer information in response to ImageHistory operation"
required: [Id, Created, CreatedBy, Tags, Size, Comment]
properties:
Id:
type: "string"
x-nullable: false
Created:
type: "integer"
format: "int64"
x-nullable: false
CreatedBy:
type: "string"
x-nullable: false
Tags:
type: "array"
items:
type: "string"
Size:
type: "integer"
format: "int64"
x-nullable: false
Comment:
type: "string"
x-nullable: false
PortSummary:
type: "object"
description: |
@@ -9848,33 +9876,7 @@ paths:
schema:
type: "array"
items:
type: "object"
x-go-name: HistoryResponseItem
title: "HistoryResponseItem"
description: "individual image layer information in response to ImageHistory operation"
required: [Id, Created, CreatedBy, Tags, Size, Comment]
properties:
Id:
type: "string"
x-nullable: false
Created:
type: "integer"
format: "int64"
x-nullable: false
CreatedBy:
type: "string"
x-nullable: false
Tags:
type: "array"
items:
type: "string"
Size:
type: "integer"
format: "int64"
x-nullable: false
Comment:
type: "string"
x-nullable: false
$ref: "#/definitions/ImageHistoryResponseItem"
examples:
application/json:
- Id: "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710"

View File

@@ -2,13 +2,12 @@
package image
// ----------------------------------------------------------------------------
// Code generated by `swagger generate operation`.
//
// See hack/generate-swagger-api.sh
// ----------------------------------------------------------------------------
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// HistoryResponseItem individual image layer information in response to ImageHistory operation
// HistoryResponseItem HistoryResponseItem
//
// individual image layer information in response to ImageHistory operation
//
// swagger:model HistoryResponseItem
type HistoryResponseItem struct {

View File

@@ -2,13 +2,12 @@
package image
// ----------------------------------------------------------------------------
// Code generated by `swagger generate operation`.
//
// See hack/generate-swagger-api.sh
// ----------------------------------------------------------------------------
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// HistoryResponseItem individual image layer information in response to ImageHistory operation
// HistoryResponseItem HistoryResponseItem
//
// individual image layer information in response to ImageHistory operation
//
// swagger:model HistoryResponseItem
type HistoryResponseItem struct {