Revert "add method to return the title"

This reverts commit 090f1b31ba675eebc2fcb4d2032d4bf11336f993.
This commit is contained in:
William Cheng 2024-09-19 11:58:27 +08:00
parent 0338d84274
commit 8084e6722b
8 changed files with 7 additions and 20 deletions

View File

@ -8480,17 +8480,4 @@ public class DefaultCodegen implements CodegenConfig {
} }
operation.hasParams = !operation.allParams.isEmpty(); operation.hasParams = !operation.allParams.isEmpty();
} }
/**
* Returns the title in the info section of the spec or default to openapi if not defined.
*
* @return title
*/
protected String getInfoTitle() {
if (openAPI.getInfo() != null) {
return openAPI.getInfo().getTitle();
} else {
return "openapi"; // default to openapi if title not set
}
}
} }

View File

@ -160,7 +160,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
@Override @Override
public void preprocessOpenAPI(OpenAPI openAPI) { public void preprocessOpenAPI(OpenAPI openAPI) {
String calloutLabel = getInfoTitle(); String calloutLabel = openAPI.getInfo().getTitle();
if (StringUtils.isNotBlank(namedCredential)) { if (StringUtils.isNotBlank(namedCredential)) {
calloutLabel = namedCredential; calloutLabel = namedCredential;
} }

View File

@ -550,7 +550,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
@Override @Override
public void preprocessOpenAPI(OpenAPI openAPI) { public void preprocessOpenAPI(OpenAPI openAPI) {
String baseTitle = getInfoTitle(); String baseTitle = openAPI.getInfo().getTitle();
if (StringUtils.isBlank(baseTitle)) { if (StringUtils.isBlank(baseTitle)) {
baseTitle = "OpenAPI"; baseTitle = "OpenAPI";

View File

@ -275,7 +275,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf
@Override @Override
public void preprocessOpenAPI(OpenAPI openAPI) { public void preprocessOpenAPI(OpenAPI openAPI) {
// From the title, compute a reasonable name for the package and the API // From the title, compute a reasonable name for the package and the API
String title = getInfoTitle(); String title = openAPI.getInfo().getTitle();
// Drop any API suffix // Drop any API suffix
if (title == null) { if (title == null) {

View File

@ -471,7 +471,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen {
if (!additionalProperties.containsKey(TITLE)) { if (!additionalProperties.containsKey(TITLE)) {
// From the title, compute a reasonable name for the package and the // From the title, compute a reasonable name for the package and the
// API // API
String title = getInfoTitle(); String title = openAPI.getInfo().getTitle();
// Drop any API suffix // Drop any API suffix
if (title != null) { if (title != null) {

View File

@ -771,7 +771,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
// This is an additional step we add when pre-processing the API spec, if // This is an additional step we add when pre-processing the API spec, if
// there is no user configuration set for the `title` of the project, // there is no user configuration set for the `title` of the project,
// we try build and normalise a title from the API spec itself. // we try build and normalise a title from the API spec itself.
String title = getInfoTitle(); String title = openAPI.getInfo().getTitle();
// Drop any API suffix // Drop any API suffix
if (title != null) { if (title != null) {

View File

@ -689,7 +689,7 @@ public class SpringCodegen extends AbstractJavaCodegen
if (!additionalProperties.containsKey(TITLE)) { if (!additionalProperties.containsKey(TITLE)) {
// From the title, compute a reasonable name for the package and the API // From the title, compute a reasonable name for the package and the API
String title = getInfoTitle(); String title = openAPI.getInfo().getTitle();
// Drop any API suffix // Drop any API suffix
if (title != null) { if (title != null) {

View File

@ -230,7 +230,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
Markdown markInstance = new Markdown(); Markdown markInstance = new Markdown();
openAPI.getInfo().setDescription(markInstance.toHtml(currentDescription)); openAPI.getInfo().setDescription(markInstance.toHtml(currentDescription));
} else { } else {
LOGGER.error("OpenAPI object description is empty [{}]", getInfoTitle()); LOGGER.error("OpenAPI object description is empty [{}]", openAPI.getInfo().getTitle());
} }
} }