···13131414 Object.entries(openApi.components.schemas ?? {}).forEach(
1515 ([definitionName, definition]) => {
1616- const definitionType = getType(definitionName);
1717- const model = getModel(
1818- openApi,
1616+ const definitionType = getType({ type: definitionName });
1717+ const model = getModel({
1918 definition,
2020- true,
2121- definitionType.base.replace(reservedWords, '_$1'),
2222- );
1919+ isDefinition: true,
2020+ meta: {
2121+ $ref: `#/components/schemas/${definitionName}`,
2222+ name: definitionType.base.replace(reservedWords, '_$1'),
2323+ },
2424+ openApi,
2525+ });
2326 models = [...models, model];
2427 },
2528 );
···3134 return;
3235 }
33363434- const definitionType = getType(definitionName);
3535- const model = getModel(
3737+ const definitionType = getType({ type: definitionName });
3838+ const model = getModel({
3939+ definition: schema,
4040+ isDefinition: true,
4141+ meta: {
4242+ $ref: `#/components/parameters/${definitionName}`,
4343+ /**
4444+ * Prefix parameter names to avoid name conflicts with schemas.
4545+ * Assuming people are mostly interested in importing schema types
4646+ * and don't care about this name as much. It should be resolved in
4747+ * a cleaner way, there just isn't a good deduplication strategy
4848+ * today. This is a workaround in the meantime, hopefully reducing
4949+ * the chance of conflicts.
5050+ *
5151+ * Example where this would break: schema named `ParameterFoo` and
5252+ * parameter named `Foo` (this would transform to `ParameterFoo`)
5353+ *
5454+ * Note: there's a related code to this workaround in `getType()`
5555+ * method that needs to be cleaned up when this is addressed.
5656+ */
5757+ name: `Parameter${definitionType.base.replace(reservedWords, '_$1')}`,
5858+ },
3659 openApi,
3737- schema,
3838- true,
3939- // prefix parameter names to avoid conflicts, assuming people are mostly
4040- // interested in importing schema types and don't care about this naming
4141- `Parameter${definitionType.base.replace(reservedWords, '_$1')}`,
4242- );
6060+ });
4361 model.deprecated = definition.deprecated;
4462 model.description = definition.description || null;
4563 models = [...models, model];
···445445 propA?: Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>;
446446};
447447448448-export type Enum1 = 'Bird' | 'Dog';
448448+export type e_num_1Период = 'Bird' | 'Dog';
449449450450export type ConstValue = "ConstValue";
451451···453453 * This is a model with one property with a 'any of' relationship where the options are not $ref
454454 */
455455export type CompositionWithNestedAnyOfAndNull = {
456456- propA?: Array<(Enum1 | ConstValue)> | null;
456456+ propA?: Array<(e_num_1Период | ConstValue)> | null;
457457};
458458459459/**
···811811};
812812813813/**
814814+ * Model used to test deduplication strategy (unused)
815815+ */
816816+export type ParameterSimpleParameterUnused = string;
817817+818818+/**
819819+ * Model used to test deduplication strategy
820820+ */
821821+export type PostServiceWithEmptyTagResponse = string;
822822+823823+/**
824824+ * Model used to test deduplication strategy
825825+ */
826826+export type PostServiceWithEmptyTagResponse2 = string;
827827+828828+/**
829829+ * Model used to test deduplication strategy
830830+ */
831831+export type DeleteFooData = string;
832832+833833+/**
834834+ * Model used to test deduplication strategy
835835+ */
836836+export type DeleteFooData2 = string;
837837+838838+/**
814839 * This is a reusable parameter
815840 */
816841export type ParameterSimpleParameter = string;
···824849 requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly;
825850};
826851827827-export type PostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly;
852852+export type PostServiceWithEmptyTagResponse3 = ModelWithReadOnlyAndWriteOnly;
828853829854export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk;
830855831831-export type DeleteFooData = {
856856+export type DeleteFooData3 = {
832857 /**
833858 * bar in method
834859 */
···445445 propA?: Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>;
446446};
447447448448-export type Enum1 = 'Bird' | 'Dog';
448448+export type e_num_1Период = 'Bird' | 'Dog';
449449450450export type ConstValue = "ConstValue";
451451···453453 * This is a model with one property with a 'any of' relationship where the options are not $ref
454454 */
455455export type CompositionWithNestedAnyOfAndNull = {
456456- propA?: Array<(Enum1 | ConstValue)> | null;
456456+ propA?: Array<(e_num_1Период | ConstValue)> | null;
457457};
458458459459/**
···811811};
812812813813/**
814814+ * Model used to test deduplication strategy (unused)
815815+ */
816816+export type ParameterSimpleParameterUnused = string;
817817+818818+/**
819819+ * Model used to test deduplication strategy
820820+ */
821821+export type PostServiceWithEmptyTagResponse = string;
822822+823823+/**
824824+ * Model used to test deduplication strategy
825825+ */
826826+export type PostServiceWithEmptyTagResponse2 = string;
827827+828828+/**
829829+ * Model used to test deduplication strategy
830830+ */
831831+export type DeleteFooData = string;
832832+833833+/**
834834+ * Model used to test deduplication strategy
835835+ */
836836+export type DeleteFooData2 = string;
837837+838838+/**
814839 * This is a reusable parameter
815840 */
816841export type ParameterSimpleParameter = string;
···824849 requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly;
825850};
826851827827-export type PostServiceWithEmptyTagResponse = ModelWithReadOnlyAndWriteOnly;
852852+export type PostServiceWithEmptyTagResponse3 = ModelWithReadOnlyAndWriteOnly;
828853829854export type ApiVversionOdataControllerCountResponse = Model_From_Zendesk;
830855831831-export type DeleteFooData = {
856856+export type DeleteFooData3 = {
832857 /**
833858 * bar in method
834859 */
···445445 propA?: Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>;
446446};
447447448448-export type Enum1 = 'Bird' | 'Dog';
448448+export type e_num_1Период = 'Bird' | 'Dog';
449449450450export type ConstValue = "ConstValue";
451451···453453 * This is a model with one property with a 'any of' relationship where the options are not $ref
454454 */
455455export type CompositionWithNestedAnyOfAndNull = {
456456- propA?: Array<(Enum1 | ConstValue)> | null;
456456+ propA?: Array<(e_num_1Период | ConstValue)> | null;
457457};
458458459459/**
···809809 */
810810 template?: string;
811811};
812812+813813+/**
814814+ * Model used to test deduplication strategy (unused)
815815+ */
816816+export type ParameterSimpleParameterUnused = string;
817817+818818+/**
819819+ * Model used to test deduplication strategy
820820+ */
821821+export type PostServiceWithEmptyTagResponse = string;
822822+823823+/**
824824+ * Model used to test deduplication strategy
825825+ */
826826+export type PostServiceWithEmptyTagResponse2 = string;
827827+828828+/**
829829+ * Model used to test deduplication strategy
830830+ */
831831+export type DeleteFooData = string;
832832+833833+/**
834834+ * Model used to test deduplication strategy
835835+ */
836836+export type DeleteFooData2 = string;
812837813838/**
814839 * This is a reusable parameter