Bumps [github.com/danielgtaylor/huma/v2](https://github.com/danielgtaylor/huma) from 2.35.0 to 2.37.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/danielgtaylor/huma/releases">github.com/danielgtaylor/huma/v2's releases</a>.</em></p> <blockquote> <h2>v2.37.2</h2> <h2>Overview</h2> <p>This bugfix release fixes an issue with how form data was being documented in OpenAPI.</p> <p>This also fixes embedded objects with valid JSON tags being incorrectly embedded in the OpenAPI docs.</p> <h2>What's Changed</h2> <ul> <li>Don't embed embedded objects with valid JSON tags by <a href="https://github.com/wolveix"><code>@wolveix</code></a> in <a href="https://redirect.github.com/danielgtaylor/huma/pull/978">danielgtaylor/huma#978</a></li> <li>Fix OpenAPI path prefix regression from $schema fix PR by <a href="https://github.com/wolveix"><code>@wolveix</code></a> in <a href="https://redirect.github.com/danielgtaylor/huma/pull/979">danielgtaylor/huma#979</a></li> <li>Fix form param doc regression by <a href="https://github.com/wolveix"><code>@wolveix</code></a> in <a href="https://redirect.github.com/danielgtaylor/huma/pull/981">danielgtaylor/huma#981</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/danielgtaylor/huma/compare/v2.37.1...v2.37.2">https://github.com/danielgtaylor/huma/compare/v2.37.1...v2.37.2</a></p> <h2>v2.37.1</h2> <h2>Overview</h2> <p>This bugfix release fixes an issue regarding the Swagger UI docs renderer, as well as fixes an issue preventing Groups from using the configurable options released in v2.37.1.</p> <p>This also brings interface constructors to <code>humamux</code>.</p> <h2>What's Changed</h2> <ul> <li>Export Gorilla Mux interface constructors by <a href="https://github.com/RangelReale"><code>@RangelReale</code></a> in <a href="https://redirect.github.com/danielgtaylor/huma/pull/965">danielgtaylor/huma#965</a></li> <li>fix(api): use proper CSP hash for inline script in Swagger doc renderer by <a href="https://github.com/leonklingele"><code>@leonklingele</code></a> in <a href="https://redirect.github.com/danielgtaylor/huma/pull/977">danielgtaylor/huma#977</a></li> <li>fix(group): ensure "Group" satisfies the configProvider interface by <a href="https://github.com/leonklingele"><code>@leonklingele</code></a> in <a href="https://redirect.github.com/danielgtaylor/huma/pull/976">danielgtaylor/huma#976</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/danielgtaylor/huma/compare/v2.37.0...v2.37.1">https://github.com/danielgtaylor/huma/compare/v2.37.0...v2.37.1</a></p> <h2>v2.37.0</h2> <h2>Overview</h2> <h3>Dropped Explicit IDN-Hostname Validation</h3> <p>This validation unintentionally imported an external library to the base Huma library. Since this was not a requested feature, it has been removed for now. The <code>idn-hostname</code> format value has become an alias for <code>hostname</code> in the meantime.</p> <h3>Operation ID Normalization</h3> <p>Spaces in operation IDs get automatically converted to hyphens now.</p> <h3>Optimizations & Fixed Memory Leak</h3> <p>Various internal operations have been optimized (~7% overall improvement): <a href="https://redirect.github.com/danielgtaylor/huma/pull/973#issue-3960297052">danielgtaylor/huma#973</a></p> <p>A memory leak when using <code>MultipartFormFiles</code> has been resolved.</p> <h3>New Configurable Options</h3> <h4>Allow Additional Properties By Default</h4> <p>A new config option has been added to allow additional properties by default. This can be set in the API config.</p> <pre lang="go"><code>config.AllowAdditionalPropertiesByDefault = true </code></pre> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="887f7d4322"><code>887f7d4</code></a> Fix form param doc regression (<a href="https://redirect.github.com/danielgtaylor/huma/issues/981">#981</a>)</li> <li><a href="f02efeb11d"><code>f02efeb</code></a> Fix OpenAPI path prefix regression from $schema fix PR (<a href="https://redirect.github.com/danielgtaylor/huma/issues/979">#979</a>)</li> <li><a href="cbf60b60af"><code>cbf60b6</code></a> Don't embed embedded objects with valid JSON tags (<a href="https://redirect.github.com/danielgtaylor/huma/issues/978">#978</a>)</li> <li><a href="6d0295c4e1"><code>6d0295c</code></a> fix(group): ensure "Group" satisfies the configProvider interface (<a href="https://redirect.github.com/danielgtaylor/huma/issues/976">#976</a>)</li> <li><a href="07ca6c5d17"><code>07ca6c5</code></a> fix(api): use proper CSP hash for inline script in Swagger doc renderer (<a href="https://redirect.github.com/danielgtaylor/huma/issues/977">#977</a>)</li> <li><a href="58edcf2bf5"><code>58edcf2</code></a> Export humamux constructors (<a href="https://redirect.github.com/danielgtaylor/huma/issues/965">#965</a>)</li> <li><a href="6c29f67c9d"><code>6c29f67</code></a> chore(api,docs): update unpkg libraries, specify SRI hash, add strict CSP (<a href="https://redirect.github.com/danielgtaylor/huma/issues/916">#916</a>)</li> <li><a href="3aee9bd172"><code>3aee9bd</code></a> Additional docs + normalize operation IDs (<a href="https://redirect.github.com/danielgtaylor/huma/issues/974">#974</a>)</li> <li><a href="e31a8198ad"><code>e31a819</code></a> Resource optimizations, Go 1.25, remove IDNA library, add benchmark CI (<a href="https://redirect.github.com/danielgtaylor/huma/issues/973">#973</a>)</li> <li><a href="ddbb810fd5"><code>ddbb810</code></a> Implement Registry and Query Validation Options (<a href="https://redirect.github.com/danielgtaylor/huma/issues/925">#925</a>)</li> <li>Additional commits viewable in <a href="https://github.com/danielgtaylor/huma/compare/v2.35.0...v2.37.2">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Radoslav Dimitrov <radoslav@stacklok.com>
110 lines
9.6 KiB
Go
110 lines
9.6 KiB
Go
package model
|
|
|
|
type Status string
|
|
|
|
const (
|
|
StatusActive Status = "active"
|
|
StatusDeprecated Status = "deprecated"
|
|
StatusDeleted Status = "deleted"
|
|
)
|
|
|
|
// Transport represents transport configuration for both Package and Remote contexts.
|
|
// For Remote context, the Variables field can be used for URL templating.
|
|
type Transport struct {
|
|
Type string `json:"type" doc:"Transport type (stdio, streamable-http, or sse)" example:"stdio"`
|
|
URL string `json:"url,omitempty" doc:"URL for streamable-http or sse transports" example:"https://api.example.com/mcp"`
|
|
Headers []KeyValueInput `json:"headers,omitempty" doc:"HTTP headers for streamable-http or sse transports"`
|
|
Variables map[string]Input `json:"variables,omitempty" doc:"Variables for URL templating in remote transports"`
|
|
}
|
|
|
|
// Package represents a package configuration.
|
|
// The RegistryType field determines which other fields are relevant:
|
|
// - NPM: RegistryType, Identifier (package name), Version, RegistryBaseURL (optional)
|
|
// - PyPI: RegistryType, Identifier (package name), Version, RegistryBaseURL (optional)
|
|
// - NuGet: RegistryType, Identifier (package ID), Version, RegistryBaseURL (optional)
|
|
// - OCI: RegistryType, Identifier (full image reference like "ghcr.io/owner/repo:tag")
|
|
// - MCPB: RegistryType, Identifier (download URL), Version (optional), FileSHA256 (required)
|
|
type Package struct {
|
|
// RegistryType indicates how to download packages (e.g., "npm", "pypi", "oci", "nuget", "mcpb")
|
|
RegistryType string `json:"registryType" minLength:"1" doc:"Registry type indicating how to download packages (e.g., 'npm', 'pypi', 'oci', 'nuget', 'mcpb')" example:"npm"`
|
|
// RegistryBaseURL is the base URL of the package registry (used by npm, pypi, nuget; not used by oci, mcpb)
|
|
RegistryBaseURL string `json:"registryBaseUrl,omitempty" format:"uri" doc:"Base URL of the package registry" example:"https://registry.npmjs.org"`
|
|
// Identifier is the package identifier:
|
|
// - For NPM/PyPI/NuGet: package name or ID
|
|
// - For OCI: full image reference (e.g., "ghcr.io/owner/repo:v1.0.0")
|
|
// - For MCPB: direct download URL
|
|
Identifier string `json:"identifier" minLength:"1" doc:"Package identifier - either a package name (for registries) or URL (for direct downloads)" example:"@modelcontextprotocol/server-brave-search"`
|
|
// Version is the package version (required for npm, pypi, nuget; optional for mcpb; not used by oci where version is in the identifier)
|
|
Version string `json:"version,omitempty" minLength:"1" doc:"Package version. Must be a specific version. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3', '>=1.2.3', '1.x', '1.*')." example:"1.0.2"`
|
|
// FileSHA256 is the SHA-256 hash for integrity verification (required for mcpb, optional for others)
|
|
FileSHA256 string `json:"fileSha256,omitempty" pattern:"^[a-f0-9]{64}$" doc:"SHA-256 hash of the package file for integrity verification. Required for MCPB packages and optional for other package types. Authors are responsible for generating correct SHA-256 hashes when creating server.json. If present, MCP clients must validate the downloaded file matches the hash before running packages to ensure file integrity." example:"fe333e598595000ae021bd27117db32ec69af6987f507ba7a63c90638ff633ce"`
|
|
// RunTimeHint suggests the appropriate runtime for the package
|
|
RunTimeHint string `json:"runtimeHint,omitempty" doc:"A hint to help clients determine the appropriate runtime for the package. This field should be provided when runtimeArguments are present." example:"npx"`
|
|
// Transport is required and specifies the transport protocol configuration
|
|
Transport Transport `json:"transport" doc:"Transport protocol configuration for the package"`
|
|
// RuntimeArguments are passed to the package's runtime command (e.g., docker, npx)
|
|
RuntimeArguments []Argument `json:"runtimeArguments,omitempty" doc:"A list of arguments to be passed to the package's runtime command (such as docker or npx). The runtimeHint field should be provided when runtimeArguments are present."`
|
|
// PackageArguments are passed to the package's binary
|
|
PackageArguments []Argument `json:"packageArguments,omitempty" doc:"A list of arguments to be passed to the package's binary."`
|
|
// EnvironmentVariables are set when running the package
|
|
EnvironmentVariables []KeyValueInput `json:"environmentVariables,omitempty" doc:"A mapping of environment variables to be set when running the package."`
|
|
}
|
|
|
|
type Repository struct {
|
|
URL string `json:"url,omitempty" format:"uri" doc:"Repository URL for browsing source code. Should support both web browsing and git clone operations." example:"https://github.com/modelcontextprotocol/servers"`
|
|
Source string `json:"source,omitempty" doc:"Repository hosting service identifier. Used by registries to determine validation and API access methods." example:"github"`
|
|
ID string `json:"id,omitempty" doc:"Repository identifier from the hosting service (e.g., GitHub repo ID). Owned and determined by the source forge. Should remain stable across repository renames and may be used to detect repository resurrection attacks - if a repository is deleted and recreated, the ID should change. For GitHub, use: gh api repos/<owner>/<repo> --jq '.id'" example:"b94b5f7e-c7c6-d760-2c78-a5e9b8a5b8c9"`
|
|
Subfolder string `json:"subfolder,omitempty" doc:"Optional relative path from repository root to the server location within a monorepo or nested package structure. Must be a clean relative path." example:"src/everything"`
|
|
}
|
|
|
|
type Format string
|
|
|
|
const (
|
|
FormatString Format = "string"
|
|
FormatNumber Format = "number"
|
|
FormatBoolean Format = "boolean"
|
|
FormatFilePath Format = "filepath"
|
|
)
|
|
|
|
type Input struct {
|
|
Description string `json:"description,omitempty" doc:"A description of the input, which clients can use to provide context to the user."`
|
|
IsRequired bool `json:"isRequired,omitempty" doc:"Whether the input is required"`
|
|
Format Format `json:"format,omitempty" enum:"string,number,boolean,filepath" doc:"Specifies the input format. Supported values include filepath, which should be interpreted as a file on the user's filesystem."`
|
|
Value string `json:"value,omitempty" doc:"The value for the input. If this is not set, the user may be prompted to provide a value. Identifiers wrapped in {curly_braces} will be replaced with the corresponding properties from the input variables map."`
|
|
IsSecret bool `json:"isSecret,omitempty" doc:"Indicates whether the input is a secret value (e.g., password, token). If true, clients should handle the value securely."`
|
|
Default string `json:"default,omitempty" doc:"The default value for the input. This should be a valid value for the input. If you want to provide input examples or guidance, use the placeholder field instead."`
|
|
Placeholder string `json:"placeholder,omitempty" doc:"A placeholder for the input to be displaying during configuration. This is used to provide examples or guidance about the expected form or content of the input."`
|
|
Choices []string `json:"choices,omitempty" doc:"A list of possible values for the input. If provided, the user must select one of these values."`
|
|
}
|
|
|
|
type InputWithVariables struct {
|
|
Input
|
|
Variables map[string]Input `json:"variables,omitempty" doc:"A map of variable names to their values. Keys in the input value that are wrapped in {curly_braces} will be replaced with the corresponding variable values."`
|
|
}
|
|
|
|
type KeyValueInput struct {
|
|
InputWithVariables
|
|
Name string `json:"name" doc:"Name of the header or environment variable." example:"SOME_VARIABLE"`
|
|
}
|
|
|
|
type ArgumentType string
|
|
|
|
const (
|
|
ArgumentTypePositional ArgumentType = "positional"
|
|
ArgumentTypeNamed ArgumentType = "named"
|
|
)
|
|
|
|
type Argument struct {
|
|
InputWithVariables
|
|
Type ArgumentType `json:"type" doc:"Argument type: 'positional' or 'named'" example:"positional"`
|
|
Name string `json:"name,omitempty" doc:"The flag name (for named arguments), including any leading dashes. Empty for positional arguments." example:"--port"`
|
|
ValueHint string `json:"valueHint,omitempty" doc:"An identifier for positional arguments. Used in transport URL variable substitution." example:"file_path"`
|
|
IsRepeated bool `json:"isRepeated,omitempty" doc:"Whether the argument can be repeated multiple times."`
|
|
}
|
|
|
|
type Icon struct {
|
|
Src string `json:"src" required:"true" format:"uri" maxLength:"255" doc:"A standard URI pointing to an icon resource. Must be an HTTPS URL. Consumers SHOULD take steps to ensure URLs serving icons are from the same domain as the server or a trusted domain. Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain executable JavaScript." example:"https://example.com/icon.png"`
|
|
MimeType *string `json:"mimeType,omitempty" enum:"image/png,image/jpeg,image/jpg,image/svg+xml,image/webp" doc:"Optional MIME type override if the source MIME type is missing or generic. Must be one of: image/png, image/jpeg, image/jpg, image/svg+xml, image/webp." example:"image/png"`
|
|
Sizes []string `json:"sizes,omitempty" doc:"Optional array of strings that specify sizes at which the icon can be used. Each string should be in WxH format (e.g., '48x48', '96x96') or 'any' for scalable formats like SVG. If not provided, the client should assume that the icon can be used at any size." items.pattern:"^(\\d+x\\d+|any)$"`
|
|
Theme *string `json:"theme,omitempty" enum:"light,dark" doc:"Optional specifier for the theme this icon is designed for. 'light' indicates the icon is designed to be used with a light background, and 'dark' indicates the icon is designed to be used with a dark background. If not provided, the client should assume the icon can be used with any theme."`
|
|
}
|