| name | servicestack-openapi-metadata |
| description | Controls OpenAPI / metadata exposure without compromising ServiceStack-first design. |
ServiceStack OpenAPI and Metadata
ServiceStack automatically generates metadata and OpenAPI (Swagger) documentation.
Enabling Features
- Metadata: Enabled by default. Access at
/metadata.
- OpenAPI: Registered as a plugin.
Plugins.Add(new OpenApiFeature());
Controlling Exposure
[Exclude(Feature.Metadata)]: Hides a service from the metadata page and Swagger.
[Exclude(Feature.Soap)]: Hides from SOAP metadata.
[Restrict(InternalOnly = true)]: Limits access to internal requests.
Customizing Swagger
- Use
[Api] on classes to provide high-level descriptions.
- Use
[ApiMember] on properties for detailed parameter info.
- Use
[Route] attributes to ensure routes are correctly documented.
Best Practices
- POCOs as Source of Truth: Let ServiceStack generate documentation from your DTOs instead of manual maintenance.
- Enrichment: Take the time to add descriptions to your DTO properties; it significantly improves the client-side experience.
- Security: Hide sensitive or internal-only services from the public metadata pages to reduce the attack surface.