Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: devexperts/swagger-codegen-ts
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0-alpha.3
Choose a base ref
...
head repository: devexperts/swagger-codegen-ts
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.0-alpha.4
Choose a head ref
  • 12 commits
  • 82 files changed
  • 1 contributor

Commits on Nov 11, 2019

  1. feat: asyncapi shema

    BREAKING CHANGE: Fragment type was added to FSEntity
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    5fc7b84 View commit details
  2. Copy the full SHA
    50dd408 View commit details
  3. feat: oneOf support for typescript openapi 3

    BREAKING CHANGE: OneOfSchemaObject type was added to SchemaObject
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    f9e2ab5 View commit details
  4. feat: support ws channel bindings

    closes #68
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    dab6d10 View commit details
  5. refactor: update SchemaObject

    BREAKING CHANGE: some codecs were renamed and moved
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    58ea69d View commit details
  6. refactor: rename ReferenceObject codec to ReferenceObjectCodec

    BREAKING CHANGE: ReferenceObject was renamed to ReferenceObjectCodec
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    bdda8e2 View commit details
  7. feat: full enum support

    BREAKING CHANGE: SchemaObject codec and interfaces were renamed
    BREAKING CHANGE: EnumSchemaObject type was added to SchemaObject
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    21a6b8c View commit details
  8. refactor: update SchemaObject

    BREAKING CHANGE: SchemaObject.format was moved to PrimitiveSchemaObject.format
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    0b4cf16 View commit details
  9. Copy the full SHA
    0288b0a View commit details
  10. Copy the full SHA
    7739952 View commit details
  11. feat: support Data Type Format in SchemaObject

    BREAKING CHANGE: IntegerSchemaObject now emits `Integer` type and `integer` codec from utils
    raveclassic committed Nov 11, 2019
    Copy the full SHA
    d8bc635 View commit details
  12. 2.0.0-alpha.4

    raveclassic committed Nov 11, 2019
    Copy the full SHA
    1b69a1f View commit details
Showing with 2,510 additions and 353 deletions.
  1. +33 −0 CHANGELOG.md
  2. +5 −0 README.md
  3. +1 −1 package.json
  4. +3 −0 src/index.ts
  5. +1 −1 src/language/typescript/2.0/serializers/__tests__/schema-object.spec.ts
  6. +1 −1 src/language/typescript/2.0/serializers/definitions-object.ts
  7. +2 −2 src/language/typescript/2.0/serializers/items-object.ts
  8. +3 −3 src/language/typescript/2.0/serializers/operation-object.ts
  9. +2 −2 src/language/typescript/2.0/serializers/parameter-object.ts
  10. +1 −1 src/language/typescript/2.0/serializers/path-item-object.ts
  11. +1 −1 src/language/typescript/2.0/serializers/paths-object.ts
  12. +56 −49 src/language/typescript/2.0/serializers/schema-object.ts
  13. +4 −3 src/language/typescript/2.0/serializers/swagger-object.ts
  14. +2 −6 src/language/typescript/3.0/serializers/components-object.ts
  15. +4 −3 src/language/typescript/3.0/serializers/document.ts
  16. +6 −14 src/language/typescript/3.0/serializers/operation-object.ts
  17. +1 −1 src/language/typescript/3.0/serializers/paths-object.ts
  18. +1 −2 src/language/typescript/3.0/serializers/request-body-object.ts
  19. +63 −20 src/language/typescript/3.0/serializers/schema-object.ts
  20. +26 −0 src/language/typescript/asyncapi-2.0.0/index.ts
  21. +45 −0 src/language/typescript/asyncapi-2.0.0/serializers/asyncapi-object.ts
  22. +137 −0 src/language/typescript/asyncapi-2.0.0/serializers/channel-item-object.ts
  23. +87 −0 src/language/typescript/asyncapi-2.0.0/serializers/channels-object.ts
  24. +150 −0 src/language/typescript/asyncapi-2.0.0/serializers/components-object.ts
  25. +16 −0 src/language/typescript/asyncapi-2.0.0/serializers/message-object.ts
  26. +90 −0 src/language/typescript/asyncapi-2.0.0/serializers/operation-object.ts
  27. +218 −0 src/language/typescript/asyncapi-2.0.0/serializers/schema-object.ts
  28. +32 −2 src/language/typescript/common/{ → bundled}/client.ts
  29. +40 −0 src/language/typescript/common/bundled/utils.ts
  30. +1 −0 src/language/typescript/common/data/serialized-dependency.ts
  31. +11 −1 src/language/typescript/common/data/serialized-parameter.ts
  32. +49 −6 src/language/typescript/common/data/serialized-type.ts
  33. +2 −0 src/language/typescript/common/utils.ts
  34. +1 −1 src/schema/2.0/definitions-object.ts
  35. +2 −2 src/schema/2.0/operation-object.ts
  36. +1 −1 src/schema/2.0/parameter-object.ts
  37. +2 −2 src/schema/2.0/path-item-object.ts
  38. +2 −1 src/schema/2.0/reference-object.ts
  39. +1 −1 src/schema/2.0/response-object.ts
  40. +2 −2 src/schema/2.0/responses-object.ts
  41. +117 −0 src/schema/2.0/schema-object.ts
  42. 0 src/schema/2.0/schema-object/all-of-schema-object.ts
  43. +0 −12 src/schema/2.0/schema-object/boolean-property-schema-object.ts
  44. +0 −16 src/schema/2.0/schema-object/integer-property-schema-object.ts
  45. +0 −16 src/schema/2.0/schema-object/number-property-schema-object.ts
  46. 0 src/schema/2.0/schema-object/reference-schema-object.ts
  47. +0 −75 src/schema/2.0/schema-object/schema-object.ts
  48. +0 −18 src/schema/2.0/schema-object/string-property-schema-object.ts
  49. +82 −27 src/schema/3.0/schema-object.ts
  50. +33 −0 src/schema/asyncapi-2.0.0/asyncapi-object.ts
  51. +19 −0 src/schema/asyncapi-2.0.0/channel-bindings-object.ts
  52. +28 −0 src/schema/asyncapi-2.0.0/channel-item-object.ts
  53. +7 −0 src/schema/asyncapi-2.0.0/channels-object.ts
  54. +60 −0 src/schema/asyncapi-2.0.0/components-object.ts
  55. +19 −0 src/schema/asyncapi-2.0.0/contact-object.ts
  56. +17 −0 src/schema/asyncapi-2.0.0/correlation-id-object.ts
  57. +17 −0 src/schema/asyncapi-2.0.0/external-documentation-object.ts
  58. +27 −0 src/schema/asyncapi-2.0.0/info-object.ts
  59. +17 −0 src/schema/asyncapi-2.0.0/license-object.ts
  60. +46 −0 src/schema/asyncapi-2.0.0/message-object.ts
  61. +40 −0 src/schema/asyncapi-2.0.0/message-trait-object.ts
  62. +45 −0 src/schema/asyncapi-2.0.0/operation-object.ts
  63. +25 −0 src/schema/asyncapi-2.0.0/operation-trait-object.ts
  64. +20 −0 src/schema/asyncapi-2.0.0/parameter-object.ts
  65. +24 −0 src/schema/asyncapi-2.0.0/parameters-object.ts
  66. +13 −0 src/schema/asyncapi-2.0.0/reference-object.ts
  67. +248 −0 src/schema/asyncapi-2.0.0/schema-object.ts
  68. +10 −0 src/schema/asyncapi-2.0.0/security-requirement-object.ts
  69. +133 −0 src/schema/asyncapi-2.0.0/security-scheme-object.ts
  70. +27 −0 src/schema/asyncapi-2.0.0/server-object.ts
  71. +21 −0 src/schema/asyncapi-2.0.0/server-variable-object.ts
  72. +23 −0 src/schema/asyncapi-2.0.0/servers-object.ts
  73. +20 −0 src/schema/asyncapi-2.0.0/tag-object.ts
  74. +7 −0 src/schema/asyncapi-2.0.0/tags-object.ts
  75. +22 −0 src/schema/asyncapi-2.0.0/websockets-channel-binding-object.ts
  76. +26 −58 src/utils/fs.ts
  77. +60 −1 src/utils/io-ts.ts
  78. +14 −0 src/utils/types.ts
  79. +13 −0 test/index.ts
  80. +40 −0 test/specs/asyncapi-2.0.0/echo.yml
  81. +82 −0 test/specs/asyncapi-2.0.0/streetlights-api.yml
  82. +3 −1 tsconfig.build.json
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
# [2.0.0-alpha.4](https://github.com/devexperts/swagger-codegen-ts/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2019-11-11)


### Code Refactoring

* rename ReferenceObject codec to ReferenceObjectCodec ([bdda8e2](https://github.com/devexperts/swagger-codegen-ts/commit/bdda8e2))
* update SchemaObject ([0b4cf16](https://github.com/devexperts/swagger-codegen-ts/commit/0b4cf16))
* update SchemaObject ([58ea69d](https://github.com/devexperts/swagger-codegen-ts/commit/58ea69d))


### Features

* add branded numeric types and codecs ([7739952](https://github.com/devexperts/swagger-codegen-ts/commit/7739952))
* asyncapi shema ([5fc7b84](https://github.com/devexperts/swagger-codegen-ts/commit/5fc7b84))
* full enum support ([21a6b8c](https://github.com/devexperts/swagger-codegen-ts/commit/21a6b8c))
* oneOf support for typescript openapi 3 ([f9e2ab5](https://github.com/devexperts/swagger-codegen-ts/commit/f9e2ab5))
* support Data Type Format in SchemaObject ([d8bc635](https://github.com/devexperts/swagger-codegen-ts/commit/d8bc635))
* support ws channel bindings ([dab6d10](https://github.com/devexperts/swagger-codegen-ts/commit/dab6d10)), closes [#68](https://github.com/devexperts/swagger-codegen-ts/issues/68)


### BREAKING CHANGES

* IntegerSchemaObject now emits `Integer` type and `integer` codec from utils
* SchemaObject.format was moved to PrimitiveSchemaObject.format
* SchemaObject codec and interfaces were renamed
* EnumSchemaObject type was added to SchemaObject
* ReferenceObject was renamed to ReferenceObjectCodec
* some codecs were renamed and moved
* OneOfSchemaObject type was added to SchemaObject
* Fragment type was added to FSEntity



# [2.0.0-alpha.3](https://github.com/devexperts/swagger-codegen-ts/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2019-11-06)


5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[![Build Status](https://travis-ci.org/devexperts/swagger-codegen-ts.svg?branch=master)](https://travis-ci.org/devexperts/swagger-codegen-ts)

### FAQ
1. **Why don't spec codecs reuse common parts?**

That's because different versions of specs refer to different versions of [JSON Schema](http://json-schema.org) and they are generally not the same. We would like to avoid maintaining JSON Schema composition in this project. (for now)

### Contributions
- use https://www.conventionalcommits.org/en/v1.0.0-beta.2/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devexperts/swagger-codegen-ts",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.4",
"description": "TS generator for swagger spec",
"main": "dist/index.js",
"scripts": {
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -75,4 +75,7 @@ const specLikeCodec = union([
type({
openapi: union([literal('3.0.0'), literal('3.0.1'), literal('3.0.2')]),
}),
type({
asyncapi: literal('2.0.0'),
}),
]);
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import {
} from '../../../common/data/serialized-type';
import { pipe } from 'fp-ts/lib/pipeable';
import { serializeSchemaObject } from '../schema-object';
import { SchemaObjectCodec } from '../../../../../schema/2.0/schema-object/schema-object';
import { SchemaObjectCodec } from '../../../../../schema/2.0/schema-object';
import { right } from 'fp-ts/lib/Either';
import { either } from 'fp-ts';
import { reportIfFailed } from '../../../../../utils/io-ts';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SchemaObject } from '../../../../schema/2.0/schema-object/schema-object';
import { SchemaObject } from '../../../../schema/2.0/schema-object';
import { directory, Directory, file, File } from '../../../../utils/fs';
import { serializeSchemaObject } from './schema-object';
import { serializeDependencies } from '../../common/data/serialized-dependency';
4 changes: 2 additions & 2 deletions src/language/typescript/2.0/serializers/items-object.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import { ItemsObject } from '../../../../schema/2.0/items-object';
import {
getSerializedArrayType,
SERIALIZED_BOOLEAN_TYPE,
SERIALIZED_NUMERIC_TYPE,
SERIALIZED_NUMBER_TYPE,
SERIALIZED_STRING_TYPE,
SerializedType,
} from '../../common/data/serialized-type';
@@ -17,7 +17,7 @@ export const serializeItemsObject = (itemsObject: ItemsObject): SerializedType =
}
case 'number':
case 'integer': {
return SERIALIZED_NUMERIC_TYPE;
return SERIALIZED_NUMBER_TYPE;
}
case 'boolean': {
return SERIALIZED_BOOLEAN_TYPE;
6 changes: 3 additions & 3 deletions src/language/typescript/2.0/serializers/operation-object.ts
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import { Either, isLeft, right } from 'fp-ts/lib/Either';
import { array, either, nonEmptyArray, option } from 'fp-ts';
import { combineEither, sequenceEither } from '@devexperts/utils/dist/adt/either.utils';
import { fromString, getRelativePath, Ref } from '../../../../utils/ref';
import { clientRef } from '../../common/client';
import { clientRef } from '../../common/bundled/client';
import {
BodyParameterObject,
FormDataParameterObject,
@@ -39,7 +39,7 @@ import {
PathParameterObject,
QueryParameterObject,
} from '../../../../schema/2.0/parameter-object';
import { ReferenceObject } from '../../../../schema/2.0/reference-object';
import { ReferenceObjectCodec } from '../../../../schema/2.0/reference-object';
import { isRequired, serializeParameterObject } from './parameter-object';
import {
fromSerializedParameter,
@@ -91,7 +91,7 @@ const getParameters = combineReader(
);

for (const parameter of parameters) {
if (ReferenceObject.is(parameter)) {
if (ReferenceObjectCodec.is(parameter)) {
const reference = fromString(parameter.$ref);
if (isLeft(reference)) {
return reference;
4 changes: 2 additions & 2 deletions src/language/typescript/2.0/serializers/parameter-object.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { ParameterObject } from '../../../../schema/2.0/parameter-object';
import {
getSerializedArrayType,
SERIALIZED_BOOLEAN_TYPE,
SERIALIZED_NUMERIC_TYPE,
SERIALIZED_NUMBER_TYPE,
SERIALIZED_STRING_TYPE,
SERIALIZED_UNKNOWN_TYPE,
} from '../../common/data/serialized-type';
@@ -31,7 +31,7 @@ export const serializeParameterObject = (
}
case 'number':
case 'integer': {
return right(toSerializedParameter(SERIALIZED_NUMERIC_TYPE));
return right(toSerializedParameter(SERIALIZED_NUMBER_TYPE));
}
case 'boolean': {
return right(toSerializedParameter(SERIALIZED_BOOLEAN_TYPE));
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
import { combineEither, sequenceEither } from '@devexperts/utils/dist/adt/either.utils';
import { either, nonEmptyArray, option, record } from 'fp-ts';
import { getRelativePath, Ref } from '../../../../utils/ref';
import { clientRef } from '../../common/client';
import { clientRef } from '../../common/bundled/client';
import { OperationObject } from '../../../../schema/2.0/operation-object';
import { tuple } from 'fp-ts/lib/function';
import { uniqString } from '../../../../utils/array';
2 changes: 1 addition & 1 deletion src/language/typescript/2.0/serializers/paths-object.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import { PathItemObject } from '../../../../schema/2.0/path-item-object';
import { camelize, decapitalize } from '@devexperts/utils/dist/string';
import { combineReader } from '@devexperts/utils/dist/adt/reader.utils';
import { serializedDependency, serializeDependencies } from '../../common/data/serialized-dependency';
import { clientRef } from '../../common/client';
import { clientRef } from '../../common/bundled/client';

export const serializePaths = combineReader(
serializePathGroup,
105 changes: 56 additions & 49 deletions src/language/typescript/2.0/serializers/schema-object.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import {
getSerializedRefType,
SERIALIZED_NUMERIC_TYPE,
SERIALIZED_NUMBER_TYPE,
SERIALIZED_BOOLEAN_TYPE,
SERIALIZED_UNKNOWN_TYPE,
serializedType,
SerializedType,
SERIALIZED_DATE_TYPE,
SERIALIZED_STRING_TYPE,
getSerializedPropertyType,
intercalateSerializedTypes,
getSerializedObjectType,
getSerializedRecursiveType,
getSerializedDictionaryType,
getSerializedIntersectionType,
getSerializedEnumType,
SERIALIZED_NULL_TYPE,
getSerializedIntegerType,
getSerializedStringType,
} from '../../common/data/serialized-type';
import { serializedDependency } from '../../common/data/serialized-dependency';
import { AllOfSchemaObject, SchemaObject } from '../../../../schema/2.0/schema-object/schema-object';
import { none, some } from 'fp-ts/lib/Option';
import {
AllOfSchemaObject,
EnumSchemaObjectCodec,
PrimitiveSchemaObject,
SchemaObject,
} from '../../../../schema/2.0/schema-object';
import { pipe } from 'fp-ts/lib/pipeable';
import { constFalse } from 'fp-ts/lib/function';
import { includes } from '../../../../utils/array';
@@ -25,7 +31,9 @@ import { Either, right } from 'fp-ts/lib/Either';
import { sequenceEither } from '@devexperts/utils/dist/adt/either.utils';
import { either, option, record } from 'fp-ts';
import { traverseNEAEither } from '../../../../utils/either';
import { ReferenceObject } from '../../../../schema/2.0/reference-object';
import { ReferenceObject, ReferenceObjectCodec } from '../../../../schema/2.0/reference-object';
import { NonEmptyArray } from 'fp-ts/lib/NonEmptyArray';
import { utilsRef } from '../../common/bundled/utils';

export const serializeSchemaObject = (from: Ref, schema: SchemaObject): Either<Error, SerializedType> =>
serializeSchemaObjectWithRecursion(from, schema, true);
@@ -36,50 +44,29 @@ const serializeSchemaObjectWithRecursion = (
shouldTrackRecursion: boolean,
): Either<Error, SerializedType> => {
// check non-typed schemas first
if (ReferenceObject.is(schema)) {
if (ReferenceObjectCodec.is(schema)) {
return pipe(
fromString(schema.$ref),
either.map(getSerializedRefType(from)),
);
}

if (EnumSchemaObjectCodec.is(schema)) {
return right(getSerializedEnumType(schema.enum));
}

if (AllOfSchemaObject.is(schema)) {
return pipe(
traverseNEAEither(schema.allOf, item => serializeSchemaObjectWithRecursion(from, item, false)),
either.map(getSerializedIntersectionType),
either.map(getSerializedRecursiveType(from, shouldTrackRecursion)),
);
return serializeAllOf(from, schema.allOf, shouldTrackRecursion);
}

// schema is typed
switch (schema.type) {
case 'string': {
return pipe(
schema.enum,
option.map(serializeEnum),
option.alt(() =>
pipe(
schema.format,
option.chain(format => {
switch (format) {
case 'date-time': {
return some(SERIALIZED_DATE_TYPE);
}
}
return none;
}),
),
),
option.getOrElse(() => SERIALIZED_STRING_TYPE),
right,
);
}
case 'boolean': {
return right(SERIALIZED_BOOLEAN_TYPE);
}
case 'null':
case 'string':
case 'number':
case 'integer':
case 'number': {
return right(SERIALIZED_NUMERIC_TYPE);
case 'boolean': {
return serializePrimitive(from, schema);
}
case 'array': {
return pipe(
@@ -139,16 +126,36 @@ const serializeSchemaObjectWithRecursion = (
}
};

const serializeEnum = (enumValue: Array<string | number | boolean>): SerializedType => {
const type = enumValue.map(value => `'${value}'`).join(' | ');
const io =
enumValue.length === 1
? `literal(${type})`
: `union([${enumValue.map(value => `literal('${value}')`).join(',')}])`;
return serializedType(
type,
io,
[serializedDependency('union', 'io-ts'), serializedDependency('literal', 'io-ts')],
[],
const serializeAllOf = (
from: Ref,
allOf: NonEmptyArray<ReferenceObject | SchemaObject>,
shouldTrackRecursion: boolean,
): Either<Error, SerializedType> =>
pipe(
traverseNEAEither(allOf, item => serializeSchemaObjectWithRecursion(from, item, false)),
either.map(getSerializedIntersectionType),
either.map(getSerializedRecursiveType(from, shouldTrackRecursion)),
);

const serializePrimitive = (from: Ref, schemaObject: PrimitiveSchemaObject): Either<Error, SerializedType> => {
switch (schemaObject.type) {
case 'null': {
return right(SERIALIZED_NULL_TYPE);
}
case 'string': {
return right(getSerializedStringType(schemaObject.format));
}
case 'number': {
return right(SERIALIZED_NUMBER_TYPE);
}
case 'integer': {
return pipe(
utilsRef,
either.map(utilsRef => getSerializedIntegerType(from, utilsRef)),
);
}
case 'boolean': {
return right(SERIALIZED_BOOLEAN_TYPE);
}
}
};
7 changes: 4 additions & 3 deletions src/language/typescript/2.0/serializers/swagger-object.ts
Original file line number Diff line number Diff line change
@@ -8,10 +8,11 @@ import { array, either, option } from 'fp-ts';
import { combineEither, sequenceEither } from '@devexperts/utils/dist/adt/either.utils';
import { SwaggerObject } from '../../../../schema/2.0/swagger-object';
import { fromString } from '../../../../utils/ref';
import { clientFile } from '../../common/client';
import { clientFile } from '../../common/bundled/client';
import { serializeParametersDefinitionsObject } from './parameters-definitions-object';
import { combineReader } from '@devexperts/utils/dist/adt/reader.utils';
import { serializeResponsesDefinitionsObject } from './responses-definitions-object';
import { utilsFile } from '../../common/bundled/utils';

const definitionsRef = fromString('#/definitions');
const parametersRef = fromString('#/parameters');
@@ -56,8 +57,8 @@ export const serializeSwaggerObject = combineReader(
pathsRef,
either.chain(from => serializePaths(from, swaggerObject.paths)),
);
return combineEither(additional, paths, clientFile, (additional, paths, clientFile) =>
directory(name, [clientFile, ...additional, paths]),
return combineEither(additional, paths, clientFile, utilsFile, (additional, paths, clientFile, utilsFile) =>
directory(name, [clientFile, utilsFile, ...additional, paths]),
);
},
);
8 changes: 2 additions & 6 deletions src/language/typescript/3.0/serializers/components-object.ts
Original file line number Diff line number Diff line change
@@ -2,11 +2,10 @@ import { Either, right } from 'fp-ts/lib/Either';
import { directory, Directory, File, file, FSEntity } from '../../../../utils/fs';
import { serializeSchemaObject } from './schema-object';
import { pipe } from 'fp-ts/lib/pipeable';
import { sequenceEither, sequenceTEither } from '@devexperts/utils/dist/adt/either.utils';
import { combineEither, sequenceEither, sequenceTEither } from '@devexperts/utils/dist/adt/either.utils';
import { array, either, option, record } from 'fp-ts';
import { serializeDependencies } from '../../common/data/serialized-dependency';
import { combineEither } from '@devexperts/utils/dist/adt/either.utils';
import { Context, getIOName, getTypeName } from '../../common/utils';
import { context, getIOName, getTypeName } from '../../common/utils';
import { addPathParts, Ref } from '../../../../utils/ref';
import { SchemaObject, SchemaObjectCodec } from '../../../../schema/3.0/schema-object';
import { ComponentsObject } from '../../../../schema/3.0/components-object';
@@ -16,14 +15,11 @@ import { ReferenceObject, ReferenceObjectCodec } from '../../../../schema/3.0/re
import { ResponseObject, ResponseObjectCodec } from '../../../../schema/3.0/response-object';
import { SERIALIZED_VOID_TYPE } from '../../common/data/serialized-type';
import { serializeResponseObject } from './response-object';
import { ask } from 'fp-ts/lib/Reader';
import { combineReader } from '@devexperts/utils/dist/adt/reader.utils';
import { reportIfFailed } from '../../../../utils/io-ts';
import { RequestBodyObject, RequestBodyObjectCodec } from '../../../../schema/3.0/request-body-object';
import { serializeRequestBodyObject } from './request-body-object';

const context = ask<Context>();

const serializeSchema = (from: Ref, schema: SchemaObject): Either<Error, File> => {
const typeName = getTypeName(from.name);
const ioName = getIOName(from.name);
7 changes: 4 additions & 3 deletions src/language/typescript/3.0/serializers/document.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,8 @@ import { array, either, option } from 'fp-ts';
import { applyTo } from '../../../../utils/function';
import { OpenapiObject } from '../../../../schema/3.0/openapi-object';
import { pathsRef } from '../../common/utils';
import { clientFile } from '../../common/client';
import { clientFile } from '../../common/bundled/client';
import { utilsFile } from '../../common/bundled/utils';

export const serializeDocument = combineReader(
serializeComponentsObject,
@@ -42,8 +43,8 @@ export const serializeDocument = combineReader(
array.compact([components]),
sequenceEither,
);
return combineEither(paths, additional, clientFile, (paths, additional, clientFile) =>
directory(name, [paths, ...additional, clientFile]),
return combineEither(paths, additional, clientFile, utilsFile, (paths, additional, clientFile, utilsFile) =>
directory(name, [paths, ...additional, clientFile, utilsFile]),
);
},
);
Loading