This commit is contained in:
John Vandenberg 2025-01-11 15:44:42 +08:00 committed by GitHub
parent 29f7c2ea0b
commit eb47b9d836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 62 additions and 62 deletions

View File

@ -21,7 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|defaultDatabaseName|Database name that will be used for all generated PostgreSQL DDL and DML statements.| ||
|idAutoIncEnabled|If `true`, generates autoincrement PostgreSQL types `SERIAL` and `BIGSERIAL` for `int32` and `int64` respectively for integer fields with name 'id'.| |false|
|identifierNamingConvention|Naming convention of PostgreSQL idebntifiers (table names and column names).|<dl><dt>**snake_case**</dt><dd>Transform named to 'snake_case'.</dd><dt>**original**</dt><dd>Leave original names as in `YAML` file.</dd></dl>|snake_case|
|jsonDataType|Use of PostgreSQL data types for complex model properties.|<dl><dt>**json**</dt><dd>Generate `JSON` fields. Value is stored in `JSON` data type field as human-readable text. Value compliance with JSON standard is checked.</dd><dt>**jsonb**</dt><dd>Generate `JSONB` fields. Value is stored in `JSONB` data type field in binary format. `JSONB` data type is generally nore efficient than `JSON` but it is not human-readable. Value compliance with JSON standard is checked.</dd><dt>**off**</dt><dd>Generate `TEXT` fields. Just store the value as plain text. Value compliance with JSON standard is not checked.</dd></dl>|json|
|jsonDataType|Use of PostgreSQL data types for complex model properties.|<dl><dt>**json**</dt><dd>Generate `JSON` fields. Value is stored in `JSON` data type field as human-readable text. Value compliance with JSON standard is checked.</dd><dt>**jsonb**</dt><dd>Generate `JSONB` fields. Value is stored in `JSONB` data type field in binary format. `JSONB` data type is generally more efficient than `JSON` but it is not human-readable. Value compliance with JSON standard is checked.</dd><dt>**off**</dt><dd>Generate `TEXT` fields. Just store the value as plain text. Value compliance with JSON standard is not checked.</dd></dl>|json|
|namedParametersEnabled|Generates query examples with named variables in value placeholders (eg.`:name`,`:quantity`) if `true`. Otherwise, generates question marks `?` in value placeholders.| |false|
## IMPORT MAPPING

View File

@ -207,7 +207,7 @@ public class InlineModelResolver {
/**
* Return false if model can be represented by primitives e.g. string, object
* without properties, array or map of other model (model contanier), etc.
* without properties, array or map of other model (model container), etc.
* <p>
* Return true if a model should be generated e.g. object with properties,
* enum, oneOf, allOf, anyOf, etc.
@ -220,7 +220,7 @@ public class InlineModelResolver {
/**
* Return false if model can be represented by primitives e.g. string, object
* without properties, array or map of other model (model contanier), etc.
* without properties, array or map of other model (model container), etc.
* <p>
* Return true if a model should be generated e.g. object with properties,
* enum, oneOf, allOf, anyOf, etc.
@ -1043,7 +1043,7 @@ public class InlineModelResolver {
* Add the schemas to the components
*
* @param name name of the inline schema
* @param schema inilne schema
* @param schema inline schema
* @return the actual model name (based on inlineSchemaNameMapping if provided)
*/
private String addSchemas(String name, Schema schema) {

View File

@ -791,7 +791,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
}
// construct data tag in the template: x-go-datatag
// originl template
// original template
// `json:"{{{baseName}}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{{baseName}}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#withValidate}} validate:"{{validate}}"{{/withValidate}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}`
String goDataTag = "json:\"" + cp.baseName;
if (!cp.required) {

View File

@ -1080,10 +1080,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
if (items.get$ref() != null) {
Map<String, Schema> shemas = this.openAPI.getComponents().getSchemas();
Map<String, Schema> schemas = this.openAPI.getComponents().getSchemas();
String ref = ModelUtils.getSimpleRef(items.get$ref());
if (ref != null) {
Schema<?> schema = shemas.get(ref);
Schema<?> schema = schemas.get(ref);
if (schema == null || ModelUtils.isObjectSchema(schema)) {
return "@Valid ";
}

View File

@ -435,7 +435,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
}
// translate @ for properties (like @type) to at_.
// Otherwise an additional "type" property will leed to duplcates
// Otherwise an additional "type" property will lead to duplicates
name = name.replaceAll("^@", "at_");
// sanitize name

View File

@ -1827,7 +1827,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
}
return pt;
} else {
if ("password".equals(cp.getFormat())) { // TDOO avoid using format, use `is` boolean flag instead
if ("password".equals(cp.getFormat())) { // TODO avoid using format, use `is` boolean flag instead
moduleImports.add("pydantic", "SecretStr");
return new PythonType("SecretStr");
} else {

View File

@ -1090,7 +1090,7 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
pydanticImports.add("constr");
return String.format(Locale.ROOT, "constr(%s)", StringUtils.join(fieldCustomization, ", "));
} else {
if ("password".equals(cp.getFormat())) { // TDOO avoid using format, use `is` boolean flag instead
if ("password".equals(cp.getFormat())) { // TODO avoid using format, use `is` boolean flag instead
pydanticImports.add("SecretStr");
return "SecretStr";
} else {
@ -1375,7 +1375,7 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
pydanticImports.add("constr");
return String.format(Locale.ROOT, "constr(%s)", StringUtils.join(fieldCustomization, ", "));
} else {
if ("password".equals(cp.getFormat())) { // TDOO avoid using format, use `is` boolean flag instead
if ("password".equals(cp.getFormat())) { // TODO avoid using format, use `is` boolean flag instead
pydanticImports.add("SecretStr");
return "SecretStr";
} else {

View File

@ -804,10 +804,10 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
additionalProperties.put(TARGET_FRAMEWORK, "netcoreapp" + aspnetCoreVersion);
}
setAddititonalPropertyForFramework();
setAdditionalPropertyForFramework();
}
private void setAddititonalPropertyForFramework() {
private void setAdditionalPropertyForFramework() {
String targetFramework = ((String)additionalProperties.get(TARGET_FRAMEWORK));
if (targetFramework.startsWith("net6.0") ||
targetFramework.startsWith("net7.0") ||

View File

@ -599,10 +599,10 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
//set .NET target version
String targetFrameworkVersion = "net" + netCoreVersion.getOptValue();
additionalProperties.put(TARGET_FRAMEWORK, targetFrameworkVersion);
setAddititonalPropertyForFramework();
setAdditionalPropertyForFramework();
}
private void setAddititonalPropertyForFramework() {
private void setAdditionalPropertyForFramework() {
if (((String)additionalProperties.get(TARGET_FRAMEWORK)).startsWith("net6.0")) {
additionalProperties.put(NET_60_OR_LATER, true);
}

View File

@ -302,11 +302,11 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
}
private String convertPathSegmentToResourceNamePart(String pathSegment) {
String convertedSegnemt = pathSegment;
String convertedSegment = pathSegment;
if (pathSegment.matches(OPEN_API_PATH_PARAM_PATTERN)) {
convertedSegnemt = pathSegment.substring(1, pathSegment.length() - 1);
convertedSegment = pathSegment.substring(1, pathSegment.length() - 1);
}
return capitalizeFirstChar(sanitizeName(convertedSegnemt));
return capitalizeFirstChar(sanitizeName(convertedSegment));
}
private String convertPathParamPattern(String pathSegment) {

View File

@ -452,7 +452,7 @@ public class KotlinServerCodegen extends AbstractKotlinCodegen implements BeanVa
/**
* Returns true if latest version of ktor is used.
*
* @return true if latest veresion of ktor is used.
* @return true if latest version of ktor is used.
*/
private boolean isKtor() {
return Constants.KTOR.equals(library);

View File

@ -313,7 +313,7 @@ public class PostgresqlSchemaCodegen extends DefaultCodegen {
"Use of PostgreSQL data types for complex model properties.");
jsonDataTypeOpt.addEnum("json", "Generate `JSON` fields. Value is stored in `JSON` data type field as human-readable text. Value compliance with JSON standard is checked.")
.addEnum("jsonb",
"Generate `JSONB` fields. Value is stored in `JSONB` data type field in binary format. `JSONB` data type is generally nore efficient than `JSON` but it is not human-readable. Value compliance with JSON standard is checked.")
"Generate `JSONB` fields. Value is stored in `JSONB` data type field in binary format. `JSONB` data type is generally more efficient than `JSON` but it is not human-readable. Value compliance with JSON standard is checked.")
.addEnum("off", "Generate `TEXT` fields. Just store the value as plain text. Value compliance with JSON standard is not checked.")
.setDefault("json");
cliOptions.add(jsonDataTypeOpt);

View File

@ -460,7 +460,7 @@ public class ScalaCaskServerCodegen extends AbstractScalaCodegen implements Code
* {{{
*
* @cask.get("/user", subpath = true)
* def userRouteDescriminator(request: cask.Request) = {
* def userRouteDiscriminator(request: cask.Request) = {
* request.remainingPathSegments match {
* case Seq("logout") => logoutUser(request)
* case Seq("login") => loginUser(request)
@ -758,7 +758,7 @@ public class ScalaCaskServerCodegen extends AbstractScalaCodegen implements Code
// ermph. Apparently 'isPrimitive' can be false while 'isNumeric' is true.
/*
* if dataType == Value then it doesn't need mapping -- this can happen with properties like ths:
* if dataType == Value then it doesn't need mapping -- this can happen with properties like this:
* {{{
* example:
* items: {}

View File

@ -383,7 +383,7 @@ public class ScalaHttp4sServerCodegen extends DefaultCodegen implements CodegenC
return modelsMap;
}
private Map<String, Object> makeRefiined(Set<String> imports, String dataType, ArrayList<String> refined) {
private Map<String, Object> makeRefined(Set<String> imports, String dataType, ArrayList<String> refined) {
Map<String, Object> vendorExtensions = new HashMap<>();
if (!refined.isEmpty()) {
imports.add("And");
@ -426,7 +426,7 @@ public class ScalaHttp4sServerCodegen extends DefaultCodegen implements CodegenC
} catch (IndexOutOfBoundsException ignored) {
}
}
vendorExtensions.putAll(makeRefiined(imports, prop.getDataType(), refined));
vendorExtensions.putAll(makeRefined(imports, prop.getDataType(), refined));
}
if ("Int".equals(prop.getDataType())
@ -455,7 +455,7 @@ public class ScalaHttp4sServerCodegen extends DefaultCodegen implements CodegenC
imports.add("LessEqual");
}
}
vendorExtensions.putAll(makeRefiined(imports, prop.getDataType(), refined));
vendorExtensions.putAll(makeRefined(imports, prop.getDataType(), refined));
}
if (prop.getIsUuid() || "Uuid".equals(prop.getDataType())) {
@ -476,7 +476,7 @@ public class ScalaHttp4sServerCodegen extends DefaultCodegen implements CodegenC
imports.add("MaxSize");
}
vendorExtensions.putAll(makeRefiined(imports, prop.getDataType(), refined));
vendorExtensions.putAll(makeRefined(imports, prop.getDataType(), refined));
}
return vendorExtensions;

View File

@ -280,7 +280,7 @@ public class {{classname}} {
{{! The `available` method would work with a `PushbackInputStream`, because we could read 1 byte to check if it exists then push it back so Jackson can read it again. The issue with that is that it will also insert an ascii character for "head of input" and that will break Jackson as it does not handle special whitespace characters. }}
{{! A fix for that problem is to read it into a string and remove those characters, but if we need to read it before giving it to jackson to fix the string then just reading it into a string as is to do an emptiness check is the cleaner solution. }}
{{! We could also manipulate the inputstream to remove that bad character, but string manipulation is easier to read and this codepath is not asyncronus so we do not gain anything by reading the stream later. }}
{{! This fix does make it unsuitable for large amounts of data because `InputStream.readAllbytes` is not meant for it, but a syncronus client is already not the right tool for that.}}
{{! This fix does make it unsuitable for large amounts of data because `InputStream.readAllbytes` is not meant for it, but a synchronous client is already not the right tool for that.}}
if (localVarResponse.body() == null) {
return new ApiResponse<{{{returnType}}}>(
localVarResponse.statusCode(),

View File

@ -17,17 +17,17 @@ namespace {{packageName}}.Test.Client
[Test]
public void TestSimpleJsonSubTypesExample()
{
var annimal =
var animal =
JsonConvert.DeserializeObject<IAnimal>("{\"Kind\":\"Dog\",\"Breed\":\"Jack Russell Terrier\"}");
Assert.AreEqual("Jack Russell Terrier", (annimal as Dog)?.Breed);
Assert.AreEqual("Jack Russell Terrier", (animal as Dog)?.Breed);
}
[Test]
public void DeserializeObjectWithCustomMapping()
{
var annimal =
var animal =
JsonConvert.DeserializeObject<Animal2>("{\"Sound\":\"Bark\",\"Breed\":\"Jack Russell Terrier\"}");
Assert.AreEqual("Jack Russell Terrier", (annimal as Dog2)?.Breed);
Assert.AreEqual("Jack Russell Terrier", (animal as Dog2)?.Breed);
}
[Test]

View File

@ -43,7 +43,7 @@
{{/if}}
__{{name}}__was__set = true
{{name}} = value
{{! Flag used to only serialize what has been explicitely set. (no nullable types, anyway null might be legit) }}
{{! Flag used to only serialize what has been explicitly set. (no nullable types, anyway null might be legit) }}
var __{{name}}__was__set := false
{{! Store the allowed values if the property is an enum }}
{{#if isEnum}}

View File

@ -111,10 +111,10 @@
} else {
// Use a for loop instead of forEach to avoid nested functions
// Otherwise "return" will not work properly
for(var propt in currentNode){
if (currentNode.hasOwnProperty(propt)) {
currentChild = currentNode[propt]
if (id == propt) {
for(var prompt in currentNode){
if (currentNode.hasOwnProperty(prompt)) {
currentChild = currentNode[prompt]
if (id == prompt) {
return currentChild;
} else {
// Search in the current child

View File

@ -90,7 +90,7 @@ class ApiException extends RequestException
}
/**
* Sets the deseralized response object (during deserialization)
* Sets the deserialized response object (during deserialization)
*
* @param mixed $obj Deserialized response object
*
@ -102,7 +102,7 @@ class ApiException extends RequestException
}
/**
* Gets the deseralized response object (during deserialization)
* Gets the deserialized response object (during deserialization)
*
* @return mixed the deserialized response object
*/

View File

@ -437,7 +437,7 @@ ApiClient <- R6::R6Class(
#'
#' @param local_var_resp The API response
#' @param return_type The target return type for the endpoint (e.g., `"object"`). If `NULL` text will be left as-is.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw resposne.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw response.
DeserializeResponse = function(local_var_resp, return_type = NULL) {
text <- local_var_resp$response_as_text()
if (is.na(text)) {
@ -454,8 +454,8 @@ ApiClient <- R6::R6Class(
#' The function will write out data.
#'
#' 1. If binary data is detected it will use `writeBin`
#' 2. If the raw response is coercable to text, the text will be written to a file
#' 3. If the raw response is not coercable to text, the raw response will be written
#' 2. If the raw response is coercible to text, the text will be written to a file
#' 3. If the raw response is not coercible to text, the raw response will be written
#'
#' @param local_var_resp The API response
#' @param file The name of the data file to save the result

View File

@ -450,7 +450,7 @@ ApiClient <- R6::R6Class(
#'
#' @param local_var_resp The API response
#' @param return_type The target return type for the endpoint (e.g., `"object"`). If `NULL` text will be left as-is.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw resposne.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw response.
DeserializeResponse = function(local_var_resp, return_type = NULL) {
text <- local_var_resp$response_as_text()
if (is.na(text)) {
@ -467,8 +467,8 @@ ApiClient <- R6::R6Class(
#' The function will write out data.
#'
#' 1. If binary data is detected it will use `writeBin`
#' 2. If the raw response is coercable to text, the text will be written to a file
#' 3. If the raw response is not coercable to text, the raw response will be written
#' 2. If the raw response is coercible to text, the text will be written to a file
#' 3. If the raw response is not coercible to text, the raw response will be written
#'
#' @param local_var_resp The API response
#' @param file The name of the data file to save the result

View File

@ -389,7 +389,7 @@ ApiClient <- R6::R6Class(
#'
#' @param local_var_resp The API response
#' @param return_type The target return type for the endpoint (e.g., `"object"`). If `NULL` text will be left as-is.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw resposne.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw response.
DeserializeResponse = function(local_var_resp, return_type = NULL) {
text <- local_var_resp$response_as_text()
if (is.na(text)) {
@ -406,8 +406,8 @@ ApiClient <- R6::R6Class(
#' The function will write out data.
#'
#' 1. If binary data is detected it will use `writeBin`
#' 2. If the raw response is coercable to text, the text will be written to a file
#' 3. If the raw response is not coercable to text, the raw response will be written
#' 2. If the raw response is coercible to text, the text will be written to a file
#' 3. If the raw response is not coercible to text, the raw response will be written
#'
#' @param local_var_resp The API response
#' @param file The name of the data file to save the result

View File

@ -439,7 +439,7 @@ ApiClient <- R6::R6Class(
#'
#' @param local_var_resp The API response
#' @param return_type The target return type for the endpoint (e.g., `"object"`). If `NULL` text will be left as-is.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw resposne.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw response.
DeserializeResponse = function(local_var_resp, return_type = NULL) {
text <- local_var_resp$response_as_text()
if (is.na(text)) {
@ -456,8 +456,8 @@ ApiClient <- R6::R6Class(
#' The function will write out data.
#'
#' 1. If binary data is detected it will use `writeBin`
#' 2. If the raw response is coercable to text, the text will be written to a file
#' 3. If the raw response is not coercable to text, the raw response will be written
#' 2. If the raw response is coercible to text, the text will be written to a file
#' 3. If the raw response is not coercible to text, the raw response will be written
#'
#' @param local_var_resp The API response
#' @param file The name of the data file to save the result

View File

@ -439,7 +439,7 @@ ApiClient <- R6::R6Class(
#'
#' @param local_var_resp The API response
#' @param return_type The target return type for the endpoint (e.g., `"object"`). If `NULL` text will be left as-is.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw resposne.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw response.
DeserializeResponse = function(local_var_resp, return_type = NULL) {
text <- local_var_resp$response_as_text()
if (is.na(text)) {
@ -456,8 +456,8 @@ ApiClient <- R6::R6Class(
#' The function will write out data.
#'
#' 1. If binary data is detected it will use `writeBin`
#' 2. If the raw response is coercable to text, the text will be written to a file
#' 3. If the raw response is not coercable to text, the raw response will be written
#' 2. If the raw response is coercible to text, the text will be written to a file
#' 3. If the raw response is not coercible to text, the raw response will be written
#'
#' @param local_var_resp The API response
#' @param file The name of the data file to save the result

View File

@ -418,7 +418,7 @@ ApiClient <- R6::R6Class(
#'
#' @param local_var_resp The API response
#' @param return_type The target return type for the endpoint (e.g., `"object"`). If `NULL` text will be left as-is.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw resposne.
#' @return If the raw response is corecable to text, return the text. Otherwise return the raw response.
DeserializeResponse = function(local_var_resp, return_type = NULL) {
text <- local_var_resp$response_as_text()
if (is.na(text)) {
@ -435,8 +435,8 @@ ApiClient <- R6::R6Class(
#' The function will write out data.
#'
#' 1. If binary data is detected it will use `writeBin`
#' 2. If the raw response is coercable to text, the text will be written to a file
#' 3. If the raw response is not coercable to text, the raw response will be written
#' 2. If the raw response is coercible to text, the text will be written to a file
#' 3. If the raw response is not coercible to text, the raw response will be written
#'
#' @param local_var_resp The API response
#' @param file The name of the data file to save the result

View File

@ -99,7 +99,7 @@ class ApiException extends RequestException
}
/**
* Sets the deseralized response object (during deserialization)
* Sets the deserialized response object (during deserialization)
*
* @param mixed $obj Deserialized response object
*
@ -111,7 +111,7 @@ class ApiException extends RequestException
}
/**
* Gets the deseralized response object (during deserialization)
* Gets the deserialized response object (during deserialization)
*
* @return mixed the deserialized response object
*/

View File

@ -163,10 +163,10 @@ h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify"
} else {
// Use a for loop instead of forEach to avoid nested functions
// Otherwise "return" will not work properly
for(var propt in currentNode){
if (currentNode.hasOwnProperty(propt)) {
currentChild = currentNode[propt]
if (id == propt) {
for(var prompt in currentNode){
if (currentNode.hasOwnProperty(prompt)) {
currentChild = currentNode[prompt]
if (id == prompt) {
return currentChild;
} else {
// Search in the current child