astahmer / openapi-zod-client

Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)

Home Page:openapi-zod-client.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot disable with-alias in playground

scarf005 opened this issue · comments

commented

image
image

commented

export const defaultOptionValues = {
baseUrl: "",
withAlias: true,
apiClientName: "api",
isMainResponseStatus: "status >= 200 && status < 300",
isErrorStatus: "!(status >= 200 && status < 300)",
isMediaTypeAllowed: "mediaType === 'application/json'",
useMainResponseDescriptionAsEndpointDefinitionFallback: false,
shouldExportAllSchemas: false,
withImplicitRequiredProps: false,
withDeprecatedEndpoints: false,
groupStrategy: "none",
complexityThreshold: 4,
defaultStatusBehavior: "spec-compliant",
} as const;

function getRelevantOptions(options: Partial<TemplateContextOptions> & { booleans?: string[] }) {
return Object.fromEntries(
Object.entries({
...options,
...Object.fromEntries((options.booleans ?? []).map((boolOption) => [boolOption, true])),
}).filter(
([name, value]) =>
Boolean(value) &&
name !== "booleans" &&
value !== defaultOptionValues[name as keyof typeof defaultOptionValues]
)
);
}

well, it was an expected behavior, however now i found a new bug: it's not possible to disable withAlias in openapi-zod-client because i've set --with-alias flag to default to true, which means #166 effectively... makes no changes. will check on that.

you're on fire ! thanks