@seamapi/nextlove-sdk-generator
Advanced tools
Comparing version 1.13.1 to 1.13.2
@@ -13,2 +13,3 @@ import { flattenObjSchema } from "../../lib/index.js"; | ||
import resolveOpenapiSpec from "../../lib/openapi/resolve-openapi-spec.js"; | ||
import { generateEntityImportsTemplate } from "./lib/get-entity-imports-template.js"; | ||
export const generateRubySDK = async (options = {}) => { | ||
@@ -21,8 +22,12 @@ const openapi = await resolveOpenapiSpec(options); | ||
const fs = {}; | ||
fs["lib/seam/routes/resources/resource_error.rb"] = resource_errorRbTemplate(); | ||
fs["lib/seam/routes/resources/resource_warning.rb"] = | ||
const lib_routes_path = "lib/seam/routes"; | ||
const lib_route_resources_path = `${lib_routes_path}/resources`; | ||
const lib_route_clients_path = `${lib_routes_path}/clients`; | ||
fs[`${lib_route_resources_path}/resource_error.rb`] = | ||
resource_errorRbTemplate(); | ||
fs[`${lib_route_resources_path}/resource_warning.rb`] = | ||
resource_warningRbTemplate(); | ||
fs["lib/seam/routes/resources/resource_errors_support.rb"] = | ||
fs[`${lib_route_resources_path}/resource_errors_support.rb`] = | ||
resource_errors_supportRbTemplate(); | ||
fs["lib/seam/routes/resources/resource_warnings_support.rb"] = | ||
fs[`${lib_route_resources_path}/resource_warnings_support.rb`] = | ||
resource_warnings_supportRbTemplate(); | ||
@@ -35,3 +40,3 @@ const resources = Object.entries(openapi.components.schemas).map(([schema_name, schema]) => [schema_name, flattenObjSchema(schema)]); | ||
})); | ||
fs[`lib/seam/routes/resources/${snake_name}.rb`] = resourceRbTemplate({ | ||
fs[`${lib_route_resources_path}/${snake_name}.rb`] = resourceRbTemplate({ | ||
pascal_name: pascalCase(snake_name), | ||
@@ -101,6 +106,13 @@ attrs: params.filter((p) => !p.is_date_time).map((p) => p.name), | ||
for (const client of Object.values(clients)) { | ||
fs[`lib/seam/routes/clients/${client.snake_name}.rb`] = client.serialize(); | ||
fs[`${lib_route_clients_path}/${client.snake_name}.rb`] = client.serialize(); | ||
} | ||
const resource_file_paths = Object.keys(fs).filter((f) => f.startsWith(lib_route_resources_path)); | ||
const client_file_paths = Object.keys(fs).filter((f) => f.startsWith(lib_route_clients_path)); | ||
const imports_file_name = "index"; | ||
fs[`${lib_route_resources_path}/${imports_file_name}.rb`] = | ||
generateEntityImportsTemplate(resource_file_paths); | ||
fs[`${lib_route_clients_path}/${imports_file_name}.rb`] = | ||
generateEntityImportsTemplate(client_file_paths); | ||
return fs; | ||
}; | ||
//# sourceMappingURL=generate-ruby-sdk.js.map |
{ | ||
"name": "@seamapi/nextlove-sdk-generator", | ||
"version": "1.13.1", | ||
"version": "1.13.2", | ||
"description": "Utilities for building NextLove SDK Generators", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -14,2 +14,3 @@ import { flattenObjSchema } from "lib/index.js" | ||
import resolveOpenapiSpec from "lib/openapi/resolve-openapi-spec.js" | ||
import { generateEntityImportsTemplate } from "./lib/get-entity-imports-template.js" | ||
@@ -24,9 +25,13 @@ export const generateRubySDK = async (options: SdkGeneratorOptions = {}) => { | ||
const fs: Record<string, string> = {} | ||
const lib_routes_path = "lib/seam/routes" | ||
const lib_route_resources_path = `${lib_routes_path}/resources` | ||
const lib_route_clients_path = `${lib_routes_path}/clients` | ||
fs["lib/seam/routes/resources/resource_error.rb"] = resource_errorRbTemplate() | ||
fs["lib/seam/routes/resources/resource_warning.rb"] = | ||
fs[`${lib_route_resources_path}/resource_error.rb`] = | ||
resource_errorRbTemplate() | ||
fs[`${lib_route_resources_path}/resource_warning.rb`] = | ||
resource_warningRbTemplate() | ||
fs["lib/seam/routes/resources/resource_errors_support.rb"] = | ||
fs[`${lib_route_resources_path}/resource_errors_support.rb`] = | ||
resource_errors_supportRbTemplate() | ||
fs["lib/seam/routes/resources/resource_warnings_support.rb"] = | ||
fs[`${lib_route_resources_path}/resource_warnings_support.rb`] = | ||
resource_warnings_supportRbTemplate() | ||
@@ -47,3 +52,3 @@ | ||
fs[`lib/seam/routes/resources/${snake_name}.rb`] = resourceRbTemplate({ | ||
fs[`${lib_route_resources_path}/${snake_name}.rb`] = resourceRbTemplate({ | ||
pascal_name: pascalCase(snake_name), | ||
@@ -130,6 +135,19 @@ attrs: params.filter((p) => !p.is_date_time).map((p) => p.name), | ||
for (const client of Object.values(clients)) { | ||
fs[`lib/seam/routes/clients/${client.snake_name}.rb`] = client.serialize() | ||
fs[`${lib_route_clients_path}/${client.snake_name}.rb`] = client.serialize() | ||
} | ||
const resource_file_paths = Object.keys(fs).filter((f) => | ||
f.startsWith(lib_route_resources_path) | ||
) | ||
const client_file_paths = Object.keys(fs).filter((f) => | ||
f.startsWith(lib_route_clients_path) | ||
) | ||
const imports_file_name = "index" | ||
fs[`${lib_route_resources_path}/${imports_file_name}.rb`] = | ||
generateEntityImportsTemplate(resource_file_paths) | ||
fs[`${lib_route_clients_path}/${imports_file_name}.rb`] = | ||
generateEntityImportsTemplate(client_file_paths) | ||
return fs | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
650785
267
8199