Repository: moby/moby
File: hack/generate-swagger-api.sh (Shell)

Code before:
	swagger generate operation --spec=api/swagger.yaml \
		--target=api --api-package=types --model-package=types \
		--config-file=api/swagger-gen.yaml \
		--template-dir=api/templates --allow-template-override \
		"$@" \
		$(printf -- '--name=%s ' "${MAPFILE[@]}")
}

# /==================================================================\
# |                                                                  |
# |  ATTENTION:                                                      |
# |                                                                  |
# |       Sort model package stanzas and model/operation names       |
# |                    *** ALPHABETICALLY ***                        |
# |          to reduce the likelihood of merge conflicts.            |
# |                                                                  |
# \==================================================================/

#region -------- Models --------

generate_model types/common <<-'EOT'
	ErrorResponse
	IDResponse
EOT

generate_model types/container <<-'EOT'
	ChangeType
	ContainerCreateResponse
	ContainerTopResponse
	ContainerUpdateResponse
	ContainerWaitExitError
	ContainerWaitResponse
	FilesystemChange
	PortSummary
EOT

generate_model types/image <<-'EOT'
	ImageDeleteResponseItem
EOT
#	ImageSummary
# TODO: Restore when go-swagger is updated
# See https://github.com/moby/moby/pull/47526#discussion_r1551800022

generate_model types/network <<-'EOT'
	NetworkCreateResponse
EOT

generate_model types/plugin <<-'EOT'
	Plugin
	PluginDevice
	PluginEnv

Review comment (suggestion):
ISTR that in one of your PRs you (temporarily) added the package name in the swagger file; I removed that, but later considered; what if we added the correct package name in all of them; that way all models could be generated in one go. Not sure if a good idea though.

Code after:
	swagger generate operation --spec=api/swagger.yaml \
		--target=api --api-package=types --model-package=types \
		--config-file=api/swagger-gen.yaml \
		--template-dir=api/templates --allow-template-override \
		"$@" \
		$(printf -- '--name=%s ' "${MAPFILE[@]}")
}

# /==================================================================\
# |                                                                  |
# |  ATTENTION:                                                      |
# |                                                                  |
# |       Sort model package stanzas and model/operation names       |
# |                    *** ALPHABETICALLY ***                        |
# |          to reduce the likelihood of merge conflicts.            |
# |                                                                  |
# \==================================================================/

#region -------- Models --------

generate_model types/common <<- 'EOT'
	ErrorResponse
	IDResponse
EOT

generate_model types/container <<- 'EOT'
	ChangeType
	ContainerCreateResponse
	ContainerTopResponse
	ContainerUpdateResponse
	ContainerWaitExitError
	ContainerWaitResponse
	FilesystemChange
	PortSummary
EOT

generate_model types/image <<- 'EOT'
	ImageDeleteResponseItem
EOT
#	ImageSummary
# TODO: Restore when go-swagger is updated
# See https://github.com/moby/moby/pull/47526#discussion_r1551800022

generate_model types/network <<- 'EOT'
	NetworkCreateResponse
EOT

generate_model types/plugin <<- 'EOT'
	Plugin
	PluginDevice
	PluginEnv