Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Jan 11, 2025
1 parent 29f7c2e commit 164a461
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion docs/generators/postgresql-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private String getInlineSchemaName(HttpMethod httpVerb, String pathname) {

/**
* 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.
Expand All @@ -220,7 +220,7 @@ private boolean isModelNeeded(Schema schema) {

/**
* 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.
Expand Down Expand Up @@ -1043,7 +1043,7 @@ private void copyVendorExtensions(Schema source, Schema target) {
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ public ModelsMap postProcessModels(ModelsMap objs) {
}

// 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,10 +1080,10 @@ private String getBeanValidation(Schema<?> items) {
}

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 ";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public String toVarName(String name) {
}

// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ private PythonType stringType(IJsonSchemaValidationProperties cp) {
}
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ private String getPydanticType(CodegenParameter cp,
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 {
Expand Down Expand Up @@ -1375,7 +1375,7 @@ private String getPydanticType(CodegenProperty cp,
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,10 +804,10 @@ private void setIsFramework() {
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") ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,10 @@ private void setAzureFunctionsVersion() {
//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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@ private String capitalizeFirstChar(String str) {
}

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private boolean isKtor2Or3() {
/**
* 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public PostgresqlSchemaCodegen() {
"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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public ParamPart(String name, CodegenParameter param) {
* {{{
*
* @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)
Expand Down Expand Up @@ -758,7 +758,7 @@ private static boolean doesNotNeedMapping(final CodegenProperty p, final Set<Str
// 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: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
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");
Expand Down Expand Up @@ -426,7 +426,7 @@ private Map<String, Object> refineProp(IJsonSchemaValidationProperties prop, Set
} catch (IndexOutOfBoundsException ignored) {
}
}
vendorExtensions.putAll(makeRefiined(imports, prop.getDataType(), refined));
vendorExtensions.putAll(makeRefined(imports, prop.getDataType(), refined));
}

if ("Int".equals(prop.getDataType())
Expand Down Expand Up @@ -455,7 +455,7 @@ private Map<String, Object> refineProp(IJsonSchemaValidationProperties prop, Set
imports.add("LessEqual");
}
}
vendorExtensions.putAll(makeRefiined(imports, prop.getDataType(), refined));
vendorExtensions.putAll(makeRefined(imports, prop.getDataType(), refined));
}

if (prop.getIsUuid() || "Uuid".equals(prop.getDataType())) {
Expand All @@ -476,7 +476,7 @@ private Map<String, Object> refineProp(IJsonSchemaValidationProperties prop, Set
imports.add("MaxSize");
}

vendorExtensions.putAll(makeRefiined(imports, prop.getDataType(), refined));
vendorExtensions.putAll(makeRefined(imports, prop.getDataType(), refined));
}

return vendorExtensions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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
Expand Down
Loading

0 comments on commit 164a461

Please sign in to comment.