Generator diagnostics
- 💀 Fatal: An issue that prevents code generation entirely.
- ❌ Error: Undesired or unexpected behavior. Resolve all errors before a 0.0.1 release.
- ⚠️ Warning: Potentially undesired or unexpected behavior. Resolve all warnings before a 1.0.0 release.
- ✍️ Note: A potential improvement or misconfiguration. Investigate all notes before a 1.0.0 release.
ClientOpt
⚠️ ClientOpt/UnnecessarilyRequired
client_settings.opts.{client_opt_name}
is non-nullable, but isn't used in everysecurity
config, so it will be unnecessarily required in some cases.Set
nullable: true
on the option or use it in everysecurity
config .
Config
❌ Config/OpenAPIReferenceInvalid
{reason}
Endpoint
❌ Endpoint/BothSpecifiedAndUnspecified
{endpoint}
is inunspecified_endpoints
, but is specified inresources
, so code will still be generated for it.An endpoint cannot be both specified and unspecified. Remove it from
unspecified_endpoints
orresources
.
❌ Endpoint/NotFound
{endpoint}
was not found in the OpenAPI spec, so code will not be generated for it.
❌ Endpoint/NotHttp
{endpoint}
is not an HTTP endpoint, but only HTTP endpoints are supported, so code will not be generated for it.An HTTP endpoint must contain:
get
,post
,put
,patch
ordelete
- Then a space
- Then a path that begins with a
/
❌ Endpoint/NotSpecified
{endpoint}
is inunspecified_endpoints
, so code will not be generated for it.
⚠️ Endpoint/NotConfigured
{endpoint}
exists in the OpenAPI spec, but isn't specified in the Stainless config, so code will not be generated for it.
✍️ Endpoint/IsIgnored
{endpoint}
is inunspecified_endpoints
, so code will not be generated for it.If this is intentional, then ignore this note. Otherwise, remove the endpoint from
unspecified_endpoints
and add it toresources
.
Go
❌ Go/DuplicateVariantNameForUnion
Variant names for union
{type_name}
at{oas_path}
overlap, as we could not infer good unique names for the variants.These are the overlapping schemas:
{variants.0}
{variants.1}
You can assign better names to these schemas by assigning a
title
or making the variant a model.
❌ Go/SnippetNotValid
This example snippet could not be formatted correctly.
The snippet:
{snippet}
stdout
:{stdout.contents}
stderr
:{stderr.contents}
⚠️ Go/NameNotAllowed
{reason}
⚠️ Go/SchemaVariantRequiresDiscriminator
Variant for union requires a property for discriminator
{discriminator_property_name}
⚠️ Go/SchemaVariantTypeNotSupported
Variant type '{variant_type}' is not currently supported
✍️ Go/DuplicateVariantDeserializationConditions
This union schema has more than one variant with the same deserialization condition, so some of the variants may never be deserialized to.
The following variants have the same deserialization condition:
{conditions.0.representation}: gjson={conditions.0.gjson_value} discriminatorValue={conditions.0.discriminator_value} {conditions.1.representation}: gjson={conditions.1.gjson_value} discriminatorValue={conditions.1.discriminator_value}
Update these variants so that they can be differentiated during deserialization or remove all but one of them.
✍️ Go/MultipleFormatsInUnion
Multiple different schema formats found for variants of {oas_path}:
{formats.0}
,{formats.1}
✍️ Go/SchemaUnionDiscriminatorMissing
This union schema has more than one object variant, but no
discriminator
property, so deserializing the union may be inefficient or ambiguous.Deserializing this union schema requires trying to match it against each object variant in sequence, which may:
- Be inefficient for large or many variants
- Result in ambiguities if two object variants have the same required properties
Adding a
discriminator
property solves these problems because it immediately indicates which variant a serialized union should be deserialized to.If these problems don't apply to this union schema, the ignore this note. Otherwise, add a
discriminator
property.
Java
❌ Java/UnsupportedAliasModel
We currently do not support generating alias models in Java/Kotlin. You will have to remove it from the config.
⚠️ Java/NameIsReserved
This schema has a name that conflicts with a reserved name, so it will be renamed from
{name}
to{new_name}
.Set a different name by doing one of:
- Defining a model
- Setting a
title
property on the schema- Extracting the schema to
#/components/schemas
⚠️ Java/NameNotAllowed
{reason}
⚠️ Java/NestedAndParentClassNamesConflict
This schema's class has the same name as one of its parent classes, so it will be renamed from
{class_name}
to{new_class_name}
.Set a different name by doing one of:
Defining a model
Setting a
title
property on the schemaExtracting the schema to
#/components/schemas
Setting an
x-stainless-naming
property on the schema like so:x-stainless-naming: java: type_name: NewClassName
✍️ Java/CollapsedUnionHasRedundantModel
This union collapses to its enum variant (
{collapsed_variant.stainless_path}
), but both are models, so only the enum model will be respected.Only define either the union or the enum variant as a model.
✍️ Java/SchemaUnionDiscriminatorMissing
This union schema has more than one object variant, but no
discriminator
property, so deserializing the union may be inefficient or ambiguous.Deserializing this union schema requires trying to match it against each object variant in sequence, which may:
- Be inefficient for large or many variants
- Result in ambiguities if two object variants have the same required properties
Adding a
discriminator
property solves these problems because it immediately indicates which variant a serialized union should be deserialized to.If these problems don't apply to this union schema, the ignore this note. Otherwise, add a
discriminator
property.
Method
❌ Method/NameNotValid
Method name invalid, please rename it: {reason}
⚠️ Method/AmbiguousEnvelopeUnwrap
Multiple properties matched potential
unwrap_response
properties:{matched_properties.0}
or{matched_properties.1}
, so unwrapping the envelope has been disabled for this endpoint.Disambiguate which unwrap property to use by setting a specific property to use, (e.g.
unwrap_response: {matched_properties.0}
on the method config.
⚠️ Method/ExpectedMatchPaginationScheme
Expected method to have matched pagination scheme {pagination_scheme} because it was explicitly configured in the method config.
Reasons why matching
{result.page}
failed:
- result.errors.0
- result.errors.1
There were matches of these other pagination styles: {other_matches.0} and {other_matches.1}
⚠️ Method/ExpectedNoPagination
Expected method to have not matched a pagination scheme because {reason}.
There were matches of these pagination styles:
If the endpoint is paginated, you can disable this diagnostic by setting paginated to
true
in the method config.Example:
methods: my_method: type: http endpoint: get /examples paginated: true
By default Stainless expects methods for paginated endpoints to be prefixed with list
. That's a simple and common convention that helps users understand that the method is paginated.
If you have a use case for a paginated method that doesn't follow that convention, you can disable this diagnostic by setting paginated to true
in the method config.
methods:
my_method:
type: http
endpoint: get /examples
paginated: true
⚠️ Method/MatchedMultiplePages
Found multiple matching pagination schemes,
{pages.0}
and{pages.1}
. Add an explicitpagination: {page_name}
to the method definition to disambiguate.
⚠️ Method/MissingEnvelopeUnwrap
Expected envelope unwrap property
{unwrap_field}
specified bysettings.unwrap_response_fields
was expected to exist on the response object, but none was found so the raw response was used.The following fields were found on the response object:
{existing_properties.0}
and{existing_properties.1}
.If this endpoint intentionally doesn't match a response envelope, you can disable matching for this endpoint by configuring the method at
{config_path}
to haveunwrap_field: false
⚠️ Method/PaginatedWithoutMatchingScheme
{path}
is paginated, but does not match any pagination scheme, so it will not be interpreted as paginated.The method is paginated because its name starts with
list
or itspaginated
property is set totrue
in the Stainless config.If this is intentional, then add a pagination scheme for the method. Otherwise, remove its
paginated
property from the Stainless config or set itspaginated
property tofalse
if the method's name starts withlist
.The following defined pagination schemes have issues:
{results.0.page}
:
{results.0.errors.0}
{results.0.errors.1}
{results.1.page}
:
{results.1.errors.0}
{results.1.errors.1}
⚠️ Method/PathComponentMissingParameter
This endpoint is missing a parameter for path component
{component}
.
⚠️ Method/PathNotValid
This method's path (
{path}
) doesn't start with/
, so the method will be ignored.
⚠️ Method/RequestBodyNotSupported
The endpoint is a GET method but has a request body. This is not recommended and will crash for JS
fetch
users.This is usually a mistake in the spec, and can be resolved by removing the request body from the endpoint. If this is how your API works, we suggest you change your API, as some javascript runtimes do not support this, and neither does the Go standard library.
✍️ Method/BodyRootParamUnnamed
This method has a non-object request body, so its argument's name in the generated code will be
{fallback_name}
.If
{fallback_name}
is an appropriate name, then ignore this note. Otherwise, setbody_param_name
in the method config to the desired name.
✍️ Method/PathHasRepeatedComponent
This endpoint has duplicate path component
{component}
in the path{endpoint}
, which may not be intended.
Model
❌ Model/DuplicateName
Another model with name
{existing_model_name}
already exists. Models should always have a unique name, or a unique namespaced name under a resource declared as astandalone_api
.
❌ Model/NotFound
{path}
was not found in the Stainless config, so it will be ignored.
⚠️ Model/DuplicateDefinition
Schema
{ref_name}
is already declared as a model at{existing_model_name}
; One of the model definitions should be removed.
⚠️ Model/ParamsSuffixNameClash
Model config
no_params_suffix
is set totrue
but the schema is used in a response so removing the suffix would cause a name clash.
✍️ Model/IsConstant
This schema has only one possible value, but it's a model, so it won't be automatically set as the default value for the user.
If the schema may have more possible values in the future, then ignore this note. Otherwise, don't define it as a model. Some SDKs conveniently set constant non-model schemas as the default for the user.
This schema's only possible value is the following:
"{constant}"
✍️ Model/IsIndirect
{config_path}
references a schema that has$ref: {schema_ref}
, but could potentially reference{schema_ref}
directly.If this is for naming or other purposes, then ignore this note. Otherwise, consider referencing
{schema_ref}
directly for clarity.
✍️ Model/NeedsRename
Consider renaming model
{model.raw_name}
; e.g.{suggestion}
'
✍️ Model/Recommended
{oas_path}
could potentially be defined as a model within#/resources/{recommended_resource_path.0}/subresources/{recommended_resource_path.1}
.The duplicated schema definition is not defined as a model so it will be duplicated in the generated code, even if the schema definition is shared using a
$ref
.If this is intentional, then ignore this note. Otherwise, consider defining the schema as a model so that it's defined once in the generated code, and then referenced multiple times.
OAS
❌ OAS/NotValid
{oas_path}
has an invalid shape: {reason}
❌ OAS/ReferenceNotFound
Reference pointed to by {ref_location} is missing from spec: {missing_pointer}
✍️ OAS/InvalidExample
Example is not valid for schema
Example:
"{value}"
{reason}
✍️ OAS/InvalidUnionExample
Could not find matching variant for the given example
"{example}"
Pagination
❌ Pagination/DuplicatePurpose
Pagination purpose '{purpose}' should only be defined once but it was defined {amount} times.
❌ Pagination/ExpectedHasNextPageToBeBoolean
Expected paginated response field
{property_name}
to be aboolean
type.
❌ Pagination/ExpectedItemsToBeObject
Expected paginated items schema to be an 'object' type.
❌ Pagination/MissingProperty
Could not infer a response property with a '{purpose}' purpose as there were 16 applicable properties
{inferred_schemas.0.schema_ref.property_info.key}
and{inferred_schemas.1.schema_ref.property_info.key}
.You need to explicitly declare which response property should be used {used_for}. For example:
{in}: {example}
❌ Pagination/UnsupportedItemsSchemaType
The paginated items schema must be an 'array' type, received '{schema.type}'.
❌ Pagination/UnsupportedPurposePlacement
Explicit pagination purpose '{purpose}' can only be set for schemas within object properties but it was set on a schema with a {schema.parent.type} parent.
❌ Pagination/UnusedPurposeConfig
Explicit pagination purpose config is defined but it was not used. Is '{schema.raw_schema.x_stainless_pagination_property.purpose}' a supported purpose for the '{page.type}' pagination type?
⚠️ Pagination/DuplicateName
A pagination config with the name
{name}
was declared multiple times.These pagination configs conflict with each other:
pagination: {indices.0}: { name: {name}, … } {indices.1}: { name: {name}, … }