@povio/openapi-codegen-cli 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export declare class SchemaResolver {
7
7
  private options;
8
8
  private schemaData;
9
9
  private zodSchemaData;
10
- private discriminatorZodSchemaData;
10
+ private compositeZodSchemaData;
11
11
  readonly dependencyGraph: ReturnType<typeof getOpenAPISchemaDependencyGraph>;
12
12
  private get docSchemas();
13
13
  private get schemaRefs();
@@ -17,12 +17,13 @@ export declare class SchemaResolver {
17
17
  getRefByZodSchemaName(zodSchemaName: string): string | undefined;
18
18
  getTagByZodSchemaName(zodSchemaName: string): string;
19
19
  getCodeByZodSchemaName(name: string): string | undefined;
20
- getZodSchemaNamesByDiscriminatorCode(code: string): string[] | undefined;
20
+ getZodSchemaNamesByCompositeCode(code: string): string[] | undefined;
21
21
  setZodSchema(name: string, code: string, tag: string): void;
22
- addZodSchemaForDiscriminatorCode(code: string, zodSchema: ZodSchema, zodSchemaName: string, schema?: OpenAPIV3.SchemaObject): void;
23
- getDiscriminatorZodSchemaByZodSchemaName(zodSchemaName: string): ZodSchema | undefined;
24
- getSchemaByDiscriminatorZodSchemaName(discriminatorZodSchemaName: string): OpenAPIV3.SchemaObject | undefined;
22
+ addZodSchemaForCompositeCode(code: string, zodSchema: ZodSchema, zodSchemaName: string, schema?: OpenAPIV3.SchemaObject): void;
23
+ getCompositeZodSchemaByZodSchemaName(zodSchemaName: string): ZodSchema | undefined;
24
+ getSchemaByCompositeZodSchemaName(compositeZodSchemaName: string): OpenAPIV3.SchemaObject | undefined;
25
25
  getZodSchemas(): {};
26
+ resolveObject<T>(obj: OpenAPIV3.ReferenceObject | T): T;
26
27
  private intializeSchemaInfo;
27
28
  private initializeSchemaTags;
28
29
  }
@@ -4,25 +4,45 @@ export interface GenerateMetadataParams {
4
4
  input: string;
5
5
  options?: Partial<GenerateOptions>;
6
6
  }
7
- export type TsFieldDescriptor = {
8
- name: string;
7
+ export interface TsType {
9
8
  type: string;
10
- required: boolean;
11
9
  namespace?: string;
12
10
  filePath?: string;
13
- };
14
- export interface BaseMetadata {
11
+ }
12
+ export type TsNestedType = TsType & TsMetaType;
13
+ export type TsProperty = {
14
+ name: string;
15
+ isRequired: boolean;
16
+ } & TsType;
17
+ export type TsNestedProperty = TsProperty & TsMetaType;
18
+ export interface TsPrimitiveMetaType {
19
+ metaType: "primitive";
20
+ }
21
+ export interface TsObjectMetaType {
22
+ metaType: "object";
23
+ objectProperties: TsNestedProperty[];
24
+ isCircular?: boolean;
25
+ }
26
+ export interface TsArrayMetaType {
27
+ metaType: "array";
28
+ arrayType: TsNestedType;
29
+ }
30
+ export interface TsCompositeMetaType {
31
+ metaType: "composite";
32
+ allOf?: TsNestedType;
33
+ oneOf?: TsNestedType;
34
+ anyOf?: TsNestedType;
35
+ }
36
+ export type TsMetaType = TsPrimitiveMetaType | TsObjectMetaType | TsArrayMetaType | TsCompositeMetaType;
37
+ export type ModelMetadata = TsNestedType;
38
+ export type QueryMetadata = {
15
39
  name: string;
16
40
  filePath: string;
17
41
  namespace?: string;
18
- }
19
- export type ModelMetadata = BaseMetadata & {
20
- properties: TsFieldDescriptor[];
21
- };
22
- export type QueryMetadata = BaseMetadata & {
23
42
  isQuery: boolean;
24
43
  isMutation: boolean;
25
- params: TsFieldDescriptor[];
44
+ params: TsNestedProperty[];
45
+ response: TsNestedType;
26
46
  };
27
47
  export interface GenerateMetadata {
28
48
  openApiDoc: OpenAPIV3.Document;
@@ -15,7 +15,6 @@ export declare function mapEndpointParamsToFunctionParams({ resolver, endpoint,
15
15
  type: string;
16
16
  paramType: "Query" | "Body" | "Header" | "Path";
17
17
  required: boolean;
18
- tag: string | undefined;
19
18
  }[];
20
19
  export declare function getEndpointConfig(endpoint: Endpoint): {
21
20
  headers?: {
@@ -1,11 +1,19 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
2
  import { SchemaResolver } from "../core/SchemaResolver.class";
3
- import { TsFieldDescriptor } from "../types/metadata";
3
+ import { TsMetaType, TsType } from "../types/metadata";
4
4
  import { PrimitiveType } from "../types/openapi";
5
5
  import { GenerateOptions } from "../types/options";
6
6
  export declare function primitiveTypeToTsType(type: PrimitiveType): string;
7
- export declare function getSchemaTsProperties({ schema, resolver, options, }: {
8
- schema: OpenAPIV3.SchemaObject;
7
+ export declare function getTsType({ zodSchemaName, schema, resolver, options, }: {
8
+ zodSchemaName?: string;
9
+ schema?: OpenAPIV3.SchemaObject;
9
10
  resolver: SchemaResolver;
10
11
  options: GenerateOptions;
11
- }): TsFieldDescriptor[];
12
+ }): TsType;
13
+ export declare function getSchemaTsMetaType({ schema, isCircular, parentTypes, resolver, options, }: {
14
+ schema?: OpenAPIV3.SchemaObject;
15
+ isCircular?: boolean;
16
+ parentTypes: TsType[];
17
+ resolver: SchemaResolver;
18
+ options: GenerateOptions;
19
+ }): TsMetaType;