Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ public boolean isDateTimeType() {
public ExtendedCodegenParameter(CodegenParameter cp) {
super();

this.isDeprecated = cp.isDeprecated;
this.isFormParam = cp.isFormParam;
this.isQueryParam = cp.isQueryParam;
this.isPathParam = cp.isPathParam;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ import {
{{#allParams.0}}
export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request {
{{#allParams}}
/**
* {{#lambda.indented_star_4}}{{{unescapedDescription}}}{{/lambda.indented_star_4}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
{{paramName}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{#hasReadOnly}}Omit<{{{dataType}}}, {{#readOnlyVars}}'{{name}}'{{^-last}}|{{/-last}}{{/readOnlyVars}}>{{/hasReadOnly}}{{^hasReadOnly}}{{{dataType}}}{{/hasReadOnly}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/allParams}}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,35 @@ public void testModelsWithoutPaths() throws IOException {
TestUtils.assertFileExists(Paths.get(output + "/models/index.ts"));
}

@Test
public void testDeprecatedParameter() throws IOException {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();

Map<String, Object> properties = new HashMap<>();
// bundle parameters into a request interface so per-parameter JSDoc is emitted
properties.put("useSingleRequestParameter", true);

final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("typescript-fetch")
.setInputSpec("src/test/resources/3_0/typescript/deprecated-parameter.yaml")
.setAdditionalProperties(properties)
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));

Generator generator = new DefaultGenerator();
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
files.forEach(File::deleteOnExit);

// the deprecated `name` query parameter must carry an @deprecated JSDoc tag in the
// generated request-parameter interface
Path file = Paths.get(output + "/apis/DefaultApi.ts");
TestUtils.assertFileContains(file, "* @deprecated");

// only the single deprecated parameter is tagged (the operation is not deprecated)
String content = Files.readString(file);
Assert.assertEquals(TestUtils.countOccurrences(content, "@deprecated"), 1);
}

@Test
public void testWithoutSnapshotVersion() {
OpenAPI api = TestUtils.createOpenAPI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,21 @@ import {
} from '../models/StructuredType';

export interface CreateFileRequest {
/**
*
*/
documentBytes: Blob;
/**
*
*/
documentType: string;
/**
*
*/
properties: { [key: string]: string; };
/**
*
*/
structured?: StructuredType;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
import * as runtime from '../runtime';

export interface UploadFilesRequest {
/**
*
*/
files: Array<Blob>;
/**
*
*/
metadata?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import {
} from '../models/Club';

export interface ListRequest {
/**
* The id of the person to retrieve
*/
personId: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import {
} from '../models/Club';

export interface ListRequest {
/**
* The id of the person to retrieve
*/
personId: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import {
} from '../models/Client';

export interface 123testSpecialTagsRequest {
/**
*
*/
client: Client;
}

Expand Down
Loading
Loading