diff --git a/bin/configs/crystal-qdrant.yaml b/bin/configs/crystal-qdrant.yaml new file mode 100644 index 000000000000..86c363f6f07e --- /dev/null +++ b/bin/configs/crystal-qdrant.yaml @@ -0,0 +1,13 @@ +generatorName: crystal +outputDir: samples/client/others/crystal-qdrant +inputSpec: modules/openapi-generator/src/test/resources/3_0/crystal/qdrant.json +templateDir: modules/openapi-generator/src/main/resources/crystal +globalProperties: + apiTests: "true" + modelTests: "true" + apiDocs: "false" + modelDocs: "false" +additionalProperties: + moduleName: Qdrant::Api + shardName: qdrant-api + apiNamespace: "" diff --git a/bin/configs/crystal.yaml b/bin/configs/crystal.yaml index 76cdfcd88ac6..671c01c3e20c 100644 --- a/bin/configs/crystal.yaml +++ b/bin/configs/crystal.yaml @@ -1,7 +1,12 @@ generatorName: crystal outputDir: samples/client/petstore/crystal -inputSpec: modules/openapi-generator/src/test/resources/3_0/crystal/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml templateDir: modules/openapi-generator/src/main/resources/crystal +globalProperties: + apiTests: "true" + modelTests: "true" + apiDocs: "false" + modelDocs: "false" additionalProperties: shardVersion: 1.0.0 moduleName: Petstore diff --git a/docs/generators/crystal.md b/docs/generators/crystal.md index cf41d7e11ab0..6ff0c6b7ba1b 100644 --- a/docs/generators/crystal.md +++ b/docs/generators/crystal.md @@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Option | Description | Values | Default | | ------ | ----------- | ------ | ------- | |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|apiNamespace|sub-namespace the api resource classes are nested under, to separate them from same-named models (e.g. "Api" -> Foo::Api::Pet). Set to an empty string to nest the api classes directly under moduleName (e.g. when moduleName already ends with "Api").| |Api| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response. With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enums are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java index 6fa3e18e38a8..7e7251694404 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CrystalClientCodegen.java @@ -50,6 +50,9 @@ public class CrystalClientCodegen extends DefaultCodegen { private static final String NUMERIC_ENUM_PREFIX = "N"; protected static int emptyMethodNameCounter = 0; + private java.util.Set resourceSegments = java.util.Collections.emptySet(); + private String apiBasePrefix = ""; + @Setter protected String shardName = "openapi_client"; @Setter protected String moduleName = "OpenAPIClient"; @Setter protected String shardVersion = "1.0.0"; @@ -62,8 +65,7 @@ public class CrystalClientCodegen extends DefaultCodegen { @Setter protected String shardAuthor = ""; @Setter protected String shardAuthorEmail = ""; @Setter protected String paramsEncoder = "Crest::NestedParamsEncoder"; - protected String apiDocPath = "docs/"; - protected String modelDocPath = "docs/"; + @Setter protected String apiNamespace = "Api"; protected List primitiveTypes = new ArrayList(); public static final String SHARD_NAME = "shardName"; @@ -76,6 +78,12 @@ public class CrystalClientCodegen extends DefaultCodegen { public static final String SHARD_AUTHOR = "shardAuthor"; public static final String SHARD_AUTHOR_EMAIL = "shardAuthorEmail"; public static final String PARAMS_ENCODER = "paramsEncoder"; + public static final String API_NAMESPACE = "apiNamespace"; + + // Generated infrastructure classes that live at the moduleName root; a model named like one + // of these would clash, so toModelName renames it. + private static final Set RESERVED_MODEL_NAMES = new HashSet<>(Arrays.asList( + "Client", "Connection", "Configuration", "Response", "ApiError", "Serializable", "Validation")); public CrystalClientCodegen() { super(); @@ -128,10 +136,6 @@ public CrystalClientCodegen() { modelTestTemplateFiles.put("model_test.mustache", ".cr"); apiTestTemplateFiles.put("api_test.mustache", ".cr"); - // TODO support auto-generated doc - // modelDocTemplateFiles.put("model_doc.mustache", ".md"); - // apiDocTemplateFiles.put("api_doc.mustache", ".md"); - // default HIDE_GENERATION_TIMESTAMP to true hideGenerationTimestamp = Boolean.TRUE; @@ -211,6 +215,7 @@ public CrystalClientCodegen() { cliOptions.add(new CliOption(SHARD_AUTHOR_EMAIL, "shard author email (only one is supported).")); cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC).defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(PARAMS_ENCODER, "params_encoder setting (e.g. Crest::NestedParamsEncoder, Crest::EnumeratedFlatParamsEncoder, Crest::ZeroEnumeratedFlatParamsEncoder").defaultValue("Crest::NestedParamsEncoder")); + cliOptions.add(new CliOption(API_NAMESPACE, "sub-namespace the api resource classes are nested under, to separate them from same-named models (e.g. \"Api\" -> Foo::Api::Pet). Set to an empty string to nest the api classes directly under moduleName (e.g. when moduleName already ends with \"Api\").").defaultValue("Api")); } @Override @@ -283,9 +288,15 @@ public void processOpts() { additionalProperties.put(PARAMS_ENCODER, paramsEncoder); } - // make api and model doc path available in mustache template - additionalProperties.put("apiDocPath", apiDocPath); - additionalProperties.put("modelDocPath", modelDocPath); + // apiNamespace: the sub-namespace api classes are nested under (default "Api"). + // An empty value nests api classes directly under moduleName (no extra namespace). + if (additionalProperties.containsKey(API_NAMESPACE)) { + setApiNamespace((String) additionalProperties.get(API_NAMESPACE)); + } + additionalProperties.put(API_NAMESPACE, apiNamespace); + // explicit boolean: jmustache treats an empty string section as truthy, so guard the + // api namespace `module` wrapper on this instead of on {{#apiNamespace}}. + additionalProperties.put("apiNamespacePresent", apiNamespace != null && !apiNamespace.isEmpty()); // use constant model/api package (folder path) setModelPackage("models"); @@ -295,8 +306,11 @@ public void processOpts() { String shardFolder = srcFolder + File.separator + shardName; supportingFiles.add(new SupportingFile("api_error.mustache", shardFolder, "api_error.cr")); supportingFiles.add(new SupportingFile("configuration.mustache", shardFolder, "configuration.cr")); - supportingFiles.add(new SupportingFile("api_client.mustache", shardFolder, "api_client.cr")); - supportingFiles.add(new SupportingFile("recursive_hash.mustache", shardFolder, "recursive_hash.cr")); + supportingFiles.add(new SupportingFile("response.mustache", shardFolder, "response.cr")); + supportingFiles.add(new SupportingFile("connection.mustache", shardFolder, "connection.cr")); + supportingFiles.add(new SupportingFile("client.mustache", shardFolder, "client.cr")); + supportingFiles.add(new SupportingFile("serializable.mustache", shardFolder, "serializable.cr")); + supportingFiles.add(new SupportingFile("validation.mustache", shardFolder, "validation.cr")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); @@ -310,6 +324,62 @@ public void processOpts() { additionalProperties.put("lambdaPascalcase", new PascalCaseLambda()); } + @Override + public void preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + java.util.Set paths = openAPI.getPaths() == null + ? java.util.Collections.emptySet() : openAPI.getPaths().keySet(); + this.resourceSegments = org.openapitools.codegen.languages.crystal.CrystalApiRouting.resourceSegments(paths); + this.apiBasePrefix = additionalProperties.containsKey("apiBasePath") + ? stripSlashes((String) additionalProperties.get("apiBasePath")) + : org.openapitools.codegen.languages.crystal.CrystalApiRouting.commonBasePrefix(paths); + } + + private static String stripSlashes(String s) { + return s.replaceAll("^/+", "").replaceAll("/+$", ""); + } + + @Override + public void addOperationToGroup(String tag, String resourcePath, io.swagger.v3.oas.models.Operation operation, + CodegenOperation co, java.util.Map> operations) { + org.openapitools.codegen.languages.crystal.CrystalApiRouting.Route r = + org.openapitools.codegen.languages.crystal.CrystalApiRouting.route( + co.path, co.httpMethod, co.operationId, resourceSegments, apiBasePrefix); + String groupKey = r.resource == null ? r.namespace : r.namespace + "/" + r.resource; + co.operationId = toOperationId(r.action); + co.vendorExtensions.put("x-cr-namespace", r.namespace); + if (r.resource != null) co.vendorExtensions.put("x-cr-resource", r.resource); + + java.util.List opList = operations.computeIfAbsent(groupKey, k -> new java.util.ArrayList<>()); + // operationId uniqueness within the group (verb suffix on collision); + // re-scan after each mutation so 2+ prior collisions are handled correctly. + String unique = co.operationId; + int counter = 0; + boolean clash = uniqueClash(opList, unique); + while (clash) { + unique = co.operationId + "_" + co.httpMethod.toLowerCase(java.util.Locale.ROOT) + + (counter == 0 ? "" : "_" + counter); + counter++; + clash = uniqueClash(opList, unique); + } + if (!unique.equals(co.operationId)) { + LOGGER.warn("Crystal: action collision, renamed `{}` -> `{}`", co.operationId, unique); + co.operationId = unique; + } + co.operationIdSnakeCase = underscore(co.operationId); + co.operationIdCamelCase = camelize(co.operationId); + opList.add(co); + co.baseName = groupKey; + } + + /** Returns true if any operation in {@code opList} already uses {@code candidate} as its operationId. */ + private static boolean uniqueClash(java.util.List opList, String candidate) { + for (CodegenOperation op : opList) { + if (op.operationId.equals(candidate)) return true; + } + return false; + } + @Override public String getHelp() { return "Generates a Crystal client library (beta)."; @@ -345,16 +415,6 @@ public String modelTestFileFolder() { return outputFolder + File.separator + specFolder + File.separator + modelPackage.replace("/", File.separator); } - @Override - public String apiDocFileFolder() { - return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); - } - - @Override - public String modelDocFileFolder() { - return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); - } - @Override public String getSchemaType(Schema schema) { String openAPIType = super.getSchemaType(schema); @@ -409,6 +469,14 @@ public String toModelName(final String name) { return modelName; } + // model name cannot clash with a generated infrastructure class that lives at the + // moduleName root (Client, Connection, ...). Rename it (e.g. "Client" -> ModelClient). + if (RESERVED_MODEL_NAMES.contains(modelName)) { + String renamed = camelize("Model" + modelName); + LOGGER.warn("{} clashes with a generated class and cannot be used as model name. Renamed to {}", name, renamed); + return renamed; + } + // model name starts with number if (modelName.matches("^\\d.*")) { LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", modelName, camelize("model_" + modelName)); @@ -447,16 +515,16 @@ public String toModelDocFilename(String name) { @Override public String toApiFilename(final String name) { - // replace - with _ e.g. created-at => created_at - String filename = name; - if (apiNameSuffix != null && apiNameSuffix.length() > 0) { - filename = filename + "_" + apiNameSuffix; + // If the name contains '/', it's a namespaced group key (e.g. "dcim/cable-terminations") + // produced by addOperationToGroup — sanitize, convert each segment to underscore and join with File.separator. + if (name.contains("/")) { + String[] parts = name.split("/"); + java.util.List us = new java.util.ArrayList<>(); + for (String p : parts) us.add(underscore(sanitizeName(p.replace('-', '_')))); + return String.join(File.separator, us); } - - filename = filename.replaceAll("-", "_"); - - // e.g. PhoneNumberApi.cr => phone_number_api.cr - return underscore(filename); + // Single-segment group key or legacy name: sanitize and underscore it directly. + return underscore(sanitizeName(name.replace('-', '_'))); } @Override @@ -476,12 +544,24 @@ public String toModelTestFilename(String name) { @Override public String toApiName(String name) { - return super.toApiName(name); + // Group key format: "namespace" or "namespace/resource" (may contain hyphens or other non-word chars) + // Sanitize each segment to produce valid Crystal identifiers. + String[] parts = name.split("/"); + StringBuilder cls = new StringBuilder(); + if (apiNamespace != null && !apiNamespace.isEmpty()) cls.append(apiNamespace); + for (String p : parts) { + if (cls.length() > 0) cls.append("::"); + cls.append(camelize(sanitizeName(p.replace('-', '_')))); + } + return cls.toString(); // e.g. Api::Dcim::CableTerminations (or Dcim::CableTerminations when apiNamespace is empty) } @Override public String toEnumValue(String value, String datatype) { - if ("Integer".equals(datatype) || "Float".equals(datatype)) { + if ("Integer".equals(datatype) || "Float".equals(datatype) + || "Int32".equals(datatype) || "Int64".equals(datatype) + || "Float32".equals(datatype) || "Float64".equals(datatype) + || "BigDecimal".equals(datatype)) { return value; } else { return "\"" + escapeText(value) + "\""; @@ -530,8 +610,139 @@ public String toEnumName(CodegenProperty property) { @Override public ModelsMap postProcessModels(ModelsMap objs) { - // process enum in models - return postProcessModelsEnum(objs); + // flag models that hold a non-JSON-serializable property (e.g. ::File), so the + // generated model spec uses a lighter assertion instead of a from_json round-trip + // (JSON::Serializable cannot deserialise a ::File field, which fails to compile). + for (ModelMap mo : objs.getModels()) { + CodegenModel cm = mo.getModel(); + boolean notJsonSerializable = false; + for (CodegenProperty p : cm.getAllVars()) { + if (p.dataType != null && p.dataType.contains("::File")) { + notJsonSerializable = true; + break; + } + } + if (notJsonSerializable) { + cm.vendorExtensions.put("x-cr-not-json-serializable", Boolean.TRUE); + } + } + // process enum in models (sets isEnum flags on properties) + ModelsMap processed = postProcessModelsEnum(objs); + // flag each property that needs the unified validates macro (must run AFTER postProcessModelsEnum) + for (ModelMap mo : processed.getModels()) { + CodegenModel cm = mo.getModel(); + for (CodegenProperty p : cm.vars) { + if (p.isEnum || p.hasValidation) { + p.vendorExtensions.put("x-cr-validated", Boolean.TRUE); + } + } + + // Scalar default values for optional properties: emit the spec default instead of nil. + // Restricted to plain scalars (string/number/bool) excluding date/time, whose default + // rendering isn't guaranteed to be valid Crystal. + for (CodegenProperty p : cm.optionalVars) { + // Only emit plain scalar literals. Skip: containers; date/time (rendering not + // guaranteed valid Crystal); and any default rendered as a constant reference + // (contains "::", e.g. a referenced enum's `EnumName::CONST` — named enums are + // plain aliases here so that constant doesn't exist). + if (p.defaultValue != null && !p.isContainer && !p.isDate && !p.isDateTime + && !p.isEnum && !p.defaultValue.contains("::")) { + p.vendorExtensions.put("x-cr-default", p.defaultValue); + } + } + + // Models that allow additional properties (additionalProperties: true or a schema) + // capture + round-trip unknown keys via JSON::Serializable::Unmapped instead of + // silently dropping them. + if (cm.getAdditionalPropertiesType() != null) { + cm.vendorExtensions.put("x-cr-additional-properties", Boolean.TRUE); + } + + // Polymorphic deserialization: when a model declares a discriminator with a concrete + // mapping, emit Crystal's use_json_discriminator/use_yaml_discriminator so deserialising + // the base type dispatches to the mapped subtype. + org.openapitools.codegen.CodegenDiscriminator disc = cm.getDiscriminator(); + if (disc != null && disc.getMappedModels() != null && !disc.getMappedModels().isEmpty()) { + List entries = new ArrayList<>(); + for (org.openapitools.codegen.CodegenDiscriminator.MappedModel mm : disc.getMappedModels()) { + entries.add("\"" + mm.getMappingName() + "\" => " + mm.getModelName()); + } + String prop = disc.getPropertyBaseName() != null ? disc.getPropertyBaseName() : disc.getPropertyName(); + cm.vendorExtensions.put("x-cr-discriminator-prop", prop); + cm.vendorExtensions.put("x-cr-discriminator-map", "{" + String.join(", ", entries) + "}"); + } + } + return processed; + } + + @Override + public Map postProcessAllModels(Map objs) { + Map processed = super.postProcessAllModels(objs); + + // Build a name -> model index so parent relationships can be resolved here (parentModel + // is not yet populated during postProcessModels). + Map byName = new HashMap<>(); + for (ModelsMap mm : processed.values()) { + for (ModelMap mo : mm.getModels()) { + CodegenModel cm = mo.getModel(); + if (cm != null) byName.put(cm.classname, cm); + } + } + + for (CodegenModel cm : byName.values()) { + if (cm.parent == null) continue; + CodegenModel parent = byName.get(cm.parent); + if (parent == null) continue; + + // Crystal forbids re-annotating an ivar already defined in a superclass, and + // JSON::Serializable inherits the parent's fields, so a child must NOT re-declare + // inherited properties. Mark them so the template skips their declaration/validation. + Set inheritedBaseNames = new HashSet<>(); + for (CodegenProperty pp : parent.getAllVars()) inheritedBaseNames.add(pp.baseName); + + List all = new ArrayList<>(cm.vars); + all.addAll(cm.requiredVars); + all.addAll(cm.optionalVars); + for (CodegenProperty p : all) { + p.vendorExtensions.put("x-cr-inherited", inheritedBaseNames.contains(p.baseName)); + } + + // Arguments passed to `super(...)` from the child constructor, in the parent's own + // constructor order (required vars then optional vars). The child accepts these as + // plain (non-@) params with the same names. + List superArgs = new ArrayList<>(); + for (CodegenProperty pp : parent.requiredVars) superArgs.add(pp.name); + for (CodegenProperty pp : parent.optionalVars) superArgs.add(pp.name); + cm.vendorExtensions.put("x-cr-parent-args", String.join(", ", superArgs)); + } + + return processed; + } + + /** + * Qualify bare model-name tokens in a Crystal type string with the module name, so that inside + * an api resource class they resolve to the model and not to a same-named resource class. + * e.g. with module "Foo": "Array(Pet)" -> "Array(Foo::Pet)". Primitives (Int32, String, Array, + * Hash, ...) and already-qualified names are left untouched. + */ + private String qualifyModelTypes(String type, Set modelNames) { + if (type == null || type.isEmpty() || modelNames.isEmpty()) return type; + java.util.regex.Matcher m = java.util.regex.Pattern.compile("[A-Za-z_][A-Za-z0-9_]*").matcher(type); + StringBuilder out = new StringBuilder(); + int last = 0; + while (m.find()) { + out.append(type, last, m.start()); + String tok = m.group(); + boolean alreadyQualified = m.start() >= 1 && type.charAt(m.start() - 1) == ':'; + if (modelNames.contains(tok) && !alreadyQualified) { + out.append(moduleName).append("::").append(tok); + } else { + out.append(tok); + } + last = m.end(); + } + out.append(type.substring(last)); + return out.toString(); } @Override @@ -576,6 +787,42 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); + + OperationMap operations0 = objs.getOperations(); + String classname = (operations0 != null) ? operations0.getClassname() : ""; + + // The api classname is "::" (toApiName prefixes the configured + // api namespace, default "Api"). The template opens that namespace as an explicit + // nested `module `, so it needs the bare resource path with the prefix + // stripped. Defining it via an explicit `module` (rather than `class Api::`) + // makes the fully-qualified path actually exist even when moduleName itself ends with + // "Api"; with apiNamespace="" the api classes nest directly under moduleName. + String apiNsPrefix = (apiNamespace == null || apiNamespace.isEmpty()) ? "" : apiNamespace + "::"; + String innerClass = (!apiNsPrefix.isEmpty() && classname.startsWith(apiNsPrefix)) + ? classname.substring(apiNsPrefix.length()) : classname; + if (operations0 != null) { + operations0.put("x-cr-api-inner-class", innerClass); + } + + // Compute specHelperPath: relative path from the spec test file back to spec_helper.cr. + // The spec file lives at spec///_spec.cr, i.e. one + // directory level for api/ plus one per "::" in the (prefix-free) resource class path. + // "Pet" -> 0 "::" -> 1 level -> "../spec_helper" + // "Store::Order" -> 1 "::" -> 2 levels -> "../../spec_helper" + int colonPairs = 0; + int idx = innerClass.indexOf("::"); + while (idx != -1) { + colonPairs++; + idx = innerClass.indexOf("::", idx + 2); + } + int totalLevels = colonPairs + 1; + StringBuilder specHelperPath = new StringBuilder(); + for (int i = 0; i < totalLevels; i++) { + specHelperPath.append("../"); + } + specHelperPath.append("spec_helper"); + objs.put("specHelperPath", specHelperPath.toString()); + if (isSkipOperationExample()) { return objs; } @@ -586,6 +833,61 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List operationList = operations.getOperation(); for (CodegenOperation op : operationList) { + boolean hasHeaderParams = op.headerParams != null && !op.headerParams.isEmpty(); + boolean hasCookieParams = op.cookieParams != null && !op.cookieParams.isEmpty(); + boolean hasNamed = (op.queryParams != null && !op.queryParams.isEmpty()) + || hasHeaderParams || hasCookieParams; + op.vendorExtensions.put("x-cr-has-named-params", hasNamed); + op.vendorExtensions.put("x-cr-has-header-params", hasHeaderParams); + op.vendorExtensions.put("x-cr-has-cookie-params", hasCookieParams); + // an operation needs a `header:` hash if it has header params and/or cookie params + // (cookie params are sent via a combined Cookie header). + op.vendorExtensions.put("x-cr-has-header-or-cookie", hasHeaderParams || hasCookieParams); + + // raw body: an operation whose response media type isn't JSON (text/plain, binary, ...) + // returns the body untouched instead of JSON-decoding it. + boolean rawBody = op.produces != null && !op.produces.isEmpty() + && op.produces.stream().noneMatch(p -> { + String mt = p.get("mediaType"); + return mt != null && mt.toLowerCase(Locale.ROOT).contains("json"); + }); + op.vendorExtensions.put("x-cr-raw-body", rawBody); + + // collectionFormat: array query params that aren't "multi" must be joined into a single + // value with the right separator (csv/ssv/tsv/pipes); "multi" is left as an array and + // serialised key=a&key=b by the configured params encoder. + if (op.queryParams != null) { + for (CodegenParameter p : op.queryParams) { + if (!p.isArray || p.collectionFormat == null) continue; + String sep; + switch (p.collectionFormat) { + case "ssv": sep = " "; break; + case "tsv": sep = "\\t"; break; + case "pipes": case "pipe": sep = "|"; break; + case "csv": sep = ","; break; + default: sep = null; // "multi" (or unknown) -> no join + } + if (sep != null) p.vendorExtensions.put("x-cr-join-sep", sep); + } + } + // Inside an api resource class (e.g. Api::Pet) the unqualified name `Pet` resolves to + // the class itself, shadowing a same-named model. Qualify model types in the method + // signature and body with the module so they resolve to the model (Foo::Pet). + op.vendorExtensions.put("x-cr-return-type", qualifyModelTypes(op.returnType, modelMaps.keySet())); + // The template reads param types from the per-kind lists (pathParams, queryParams, ...), + // which are distinct objects from allParams, so qualify each of those. + for (List pl : Arrays.asList(op.pathParams, op.queryParams, + op.headerParams, op.formParams, op.cookieParams, op.allParams)) { + if (pl == null) continue; + for (CodegenParameter p : pl) { + p.vendorExtensions.put("x-cr-data-type", qualifyModelTypes(p.dataType, modelMaps.keySet())); + } + } + if (op.bodyParam != null) { + op.bodyParam.vendorExtensions.put("x-cr-data-type", + qualifyModelTypes(op.bodyParam.dataType, modelMaps.keySet())); + } + for (CodegenParameter p : op.allParams) { p.vendorExtensions.put("x-crystal-example", constructExampleCode(p, modelMaps, processedModelMaps)); } @@ -808,13 +1110,33 @@ public String escapeReservedWord(String name) { public String getTypeDeclaration(Schema schema) { if (ModelUtils.isArraySchema(schema)) { Schema inner = ModelUtils.getSchemaItems(schema); + // unresolved element type (e.g. nested array with no `items`) would emit a + // bare `Array(Array)` which Crystal reads as Array(Array(T)) and cannot + // (de)serialise; fall back to JSON::Any so the type stays valid and round-trippable + if (inner == null) { + return getSchemaType(schema) + "(JSON::Any)"; + } return getSchemaType(schema) + "(" + getTypeDeclaration(inner) + ")"; } else if (ModelUtils.isMapSchema(schema)) { Schema inner = ModelUtils.getAdditionalProperties(schema); + if (inner == null) { + return getSchemaType(schema) + "(String, JSON::Any)"; + } return getSchemaType(schema) + "(String, " + getTypeDeclaration(inner) + ")"; } - return super.getTypeDeclaration(schema); + // A schema whose element type cannot be resolved (e.g. an inner `array`/`object` + // with no items/additionalProperties) falls through to a bare collection name + // ("Array"/"Set"/"Hash"), which Crystal treats as the uninstantiated generic + // Array(T) and cannot (de)serialise. Pin the element type to JSON::Any. + String decl = super.getTypeDeclaration(schema); + if ("Array".equals(decl) || "Set".equals(decl)) { + return decl + "(JSON::Any)"; + } + if ("Hash".equals(decl)) { + return decl + "(String, JSON::Any)"; + } + return decl; } @Override @@ -933,6 +1255,111 @@ public void postProcessFile(File file, String fileType) { } } + @Override + @SuppressWarnings("unchecked") + public Map postProcessSupportingFileData(Map objs) { + Map> nsMap = new TreeMap<>(); + Map> resourcesByNs = new TreeMap<>(); + + org.openapitools.codegen.model.ApiInfoMap apiInfo = + (org.openapitools.codegen.model.ApiInfoMap) objs.get("apiInfo"); + if (apiInfo != null) { + List apis = apiInfo.getApis(); + if (apis != null) { + for (org.openapitools.codegen.model.OperationsMap operationsMap : apis) { + org.openapitools.codegen.model.OperationMap opMap = operationsMap.getOperations(); + if (opMap == null) continue; + List ops = opMap.getOperation(); + if (ops == null) continue; + for (CodegenOperation co : ops) { + String ns = (String) co.vendorExtensions.get("x-cr-namespace"); + String res = (String) co.vendorExtensions.get("x-cr-resource"); + if (ns == null) continue; + nsMap.computeIfAbsent(ns, k -> { + Map m = new HashMap<>(); + m.put("name", underscore(sanitizeName(ns.replace('-', '_')))); + m.put("className", toApiName(ns)); + return m; + }); + if (res != null) { + resourcesByNs.computeIfAbsent(ns, k -> new TreeSet<>()).add(res); + } + } + } + } + } + + List> nsList = new ArrayList<>(); + for (Map.Entry> e : nsMap.entrySet()) { + List> resList = new ArrayList<>(); + for (String res : resourcesByNs.getOrDefault(e.getKey(), Collections.emptySet())) { + Map rm = new HashMap<>(); + rm.put("accessor", underscore(sanitizeName(res.replace('-', '_')))); + rm.put("className", toApiName(e.getKey() + "/" + res)); + resList.add(rm); + } + e.getValue().put("resources", resList); + nsList.add(e.getValue()); + } + additionalProperties.put("crNamespaces", nsList); + objs.put("crNamespaces", nsList); + + orderModelsByInheritance(objs); + + return super.postProcessSupportingFileData(objs); + } + + /** + * Crystal resolves a superclass at the point a subclass is parsed, so a model file + * must be {@code require}d after the file defining its parent. The default model order + * is alphabetical, which breaks e.g. {@code class Child < Parent} when "child" sorts + * before "parent". Reorder the model list used by the shard entrypoint so every parent + * precedes its children (inheritance is acyclic, so a topological order always exists). + */ + @SuppressWarnings("unchecked") + private void orderModelsByInheritance(Map objs) { + Object modelsObj = objs.get("models"); + if (!(modelsObj instanceof List)) return; + List models = (List) modelsObj; + + Map entryByName = new LinkedHashMap<>(); + Map parentByName = new HashMap<>(); + for (Object entry : models) { + if (!(entry instanceof Map)) return; // unexpected shape: leave as-is + Object m = ((Map) entry).get("model"); + if (!(m instanceof CodegenModel)) return; + CodegenModel cm = (CodegenModel) m; + entryByName.put(cm.classname, entry); + String parent = cm.parentModel != null ? cm.parentModel.classname : cm.parent; + if (parent != null) parentByName.put(cm.classname, parent); + } + + List ordered = new ArrayList<>(models.size()); + Set placed = new HashSet<>(); + for (String name : entryByName.keySet()) { + placeModelAfterParent(name, entryByName, parentByName, placed, ordered); + } + + if (ordered.size() == models.size()) { + models.clear(); + models.addAll(ordered); + } + } + + private void placeModelAfterParent(String name, Map entryByName, + Map parentByName, Set placed, + List ordered) { + if (name == null || placed.contains(name)) return; + Object entry = entryByName.get(name); + if (entry == null) return; // parent isn't a generated model (e.g. a primitive/container) + placed.add(name); // mark before recursing so a malformed cycle can't loop forever + String parent = parentByName.get(name); + if (parent != null) { + placeModelAfterParent(parent, entryByName, parentByName, placed, ordered); + } + ordered.add(entry); + } + @Override public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.CRYSTAL; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/crystal/CrystalApiRouting.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/crystal/CrystalApiRouting.java new file mode 100644 index 000000000000..5f600b251b0e --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/crystal/CrystalApiRouting.java @@ -0,0 +1,143 @@ +// CrystalApiRouting.java +package org.openapitools.codegen.languages.crystal; + +import java.util.*; +import org.openapitools.codegen.utils.StringUtils; + +/** Pure routing logic for the Crystal generator: path -> (namespace, resource, action). */ +public final class CrystalApiRouting { + private CrystalApiRouting() {} + + private static boolean isParam(String seg) { return seg.startsWith("{") && seg.endsWith("}"); } + + private static List segments(String path) { + List out = new ArrayList<>(); + for (String s : path.split("/")) { + if (!s.isEmpty()) out.add(s); + } + return out; + } + + /** Segments that appear immediately before a {param} in at least one path. */ + public static Set resourceSegments(Collection paths) { + Set r = new HashSet<>(); + for (String path : paths) { + List segs = segments(path); + for (int i = 0; i < segs.size(); i++) { + if (!isParam(segs.get(i)) && i + 1 < segs.size() && isParam(segs.get(i + 1))) { + r.add(segs.get(i)); + } + } + } + return r; + } + + /** Longest leading run of identical literal segments shared by all paths. */ + public static String commonBasePrefix(Collection paths) { + List> all = new ArrayList<>(); + for (String p : paths) all.add(segments(p)); + StringBuilder prefix = new StringBuilder(); + for (int i = 0; ; i++) { + String candidate = null; + for (List segs : all) { + if (i >= segs.size() || isParam(segs.get(i))) return prefix.toString(); + if (candidate == null) candidate = segs.get(i); + else if (!candidate.equals(segs.get(i))) return prefix.toString(); + } + if (candidate == null) return prefix.toString(); + // only treat as base prefix if every path has more segments after it + for (List segs : all) if (segs.size() <= i + 1) return prefix.toString(); + if (prefix.length() > 0) prefix.append("/"); + prefix.append(candidate); + } + } + + /** Literal segments after stripping the base prefix and dropping {param} segments. */ + public static List literals(String path, String basePrefix) { + List segs = segments(path); + List prefix = basePrefix.isEmpty() ? Collections.emptyList() : segments(basePrefix); + int start = 0; + if (!prefix.isEmpty() && segs.size() >= prefix.size() + && segs.subList(0, prefix.size()).equals(prefix)) { + start = prefix.size(); + } + List out = new ArrayList<>(); + for (int i = start; i < segs.size(); i++) { + if (!isParam(segs.get(i))) out.add(segs.get(i)); + } + return out; + } + + /** Route triple: (namespace, resource, action). Resource may be null. */ + public static final class Route { + public final String namespace; + public final String resource; // nullable + public final String action; + public Route(String namespace, String resource, String action) { + this.namespace = namespace; + this.resource = resource; + this.action = action; + } + } + + private static String underscore(String s) { + return StringUtils.underscore(s); + } + + public static Route route(String path, String httpMethod, String operationId, + Set rset, String basePrefix) { + List lits = literals(path, basePrefix); + if (lits.isEmpty()) { + return new Route("root", null, verbAction(httpMethod, endsWithParam(path))); + } + String namespace = lits.get(0); + String resource = null; + int actionStart = 1; + if (lits.size() >= 2 && rset.contains(lits.get(1))) { + resource = lits.get(1); + actionStart = 2; + } + String group = resource == null ? namespace : namespace + "_" + resource; + String action = deriveAction(lits, actionStart, group, httpMethod, operationId, endsWithParam(path)); + return new Route(namespace, resource, action); + } + + private static boolean endsWithParam(String path) { + List segs = segments(path); + return !segs.isEmpty() && isParam(segs.get(segs.size() - 1)); + } + + private static String deriveAction(List lits, int actionStart, String group, + String httpMethod, String operationId, boolean item) { + // (a) operationId minus the group prefix + if (operationId != null && !operationId.isEmpty()) { + String op = underscore(operationId); + String g = underscore(group) + "_"; + if (op.startsWith(g) && op.length() > g.length()) { + return op.substring(g.length()); + } + } + // (b) remaining literal action segments + if (actionStart < lits.size()) { + StringBuilder sb = new StringBuilder(); + for (int i = actionStart; i < lits.size(); i++) { + if (sb.length() > 0) sb.append("_"); + sb.append(underscore(lits.get(i))); + } + return sb.toString(); + } + // (c) collection-aware verb CRUD + return verbAction(httpMethod, item); + } + + private static String verbAction(String httpMethod, boolean item) { + switch (httpMethod.toUpperCase(java.util.Locale.ROOT)) { + case "GET": return item ? "get" : "list"; + case "POST": return "create"; + case "PUT": return item ? "update" : "bulk_update"; + case "PATCH": return item ? "partial_update" : "bulk_partial_update"; + case "DELETE": return item ? "delete" : "bulk_destroy"; + default: return httpMethod.toLowerCase(java.util.Locale.ROOT); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/crystal/api.mustache b/modules/openapi-generator/src/main/resources/crystal/api.mustache index fe6b5857f8d2..7d3ff5965386 100644 --- a/modules/openapi-generator/src/main/resources/crystal/api.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/api.mustache @@ -1,189 +1,29 @@ -# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} - -require "uri" +require "json" module {{moduleName}} {{#operations}} - class {{classname}} - property api_client : ApiClient - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end +{{#apiNamespacePresent}} module {{apiNamespace}} +{{/apiNamespacePresent}} class {{x-cr-api-inner-class}} + def initialize(@conn : Connection); end {{#operation}} - {{#summary}} - # {{{.}}} - {{/summary}} - {{#notes}} - # {{{.}}} - {{/notes}} - {{#allParams}} - {{#required}} - # @param {{paramName}} [{{{dataType}}}{{^required}}?{{/required}}] {{description}} - {{/required}} - {{/allParams}} - # @return [{{{returnType}}}{{^returnType}}nil{{/returnType}}] - def {{operationId}}({{#allParams}}{{paramName}} : {{{dataType}}}{{^required}}?{{/required}}{{^required}} = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) - {{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) - {{#returnType}}data{{/returnType}}{{^returnType}}nil{{/returnType}} - end - - {{#summary}} - # {{.}} - {{/summary}} - {{#notes}} - # {{.}} - {{/notes}} - {{#allParams}} - {{#required}} - # @param {{paramName}} [{{{dataType}}}{{^required}}?{{/required}}] {{description}} - {{/required}} - {{/allParams}} - # @return [Array<({{{returnType}}}{{^returnType}}nil{{/returnType}}, Integer, Hash)>] {{#returnType}}{{{.}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers - def {{operationId}}_with_http_info({{#allParams}}{{paramName}} : {{{dataType}}}{{^required}}?{{/required}}{{^required}} = nil{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) - if @api_client.config.debugging - Log.debug {"Calling API: {{classname}}.{{operationId}} ..."} - end - {{#allParams}} - {{^isNullable}} - {{#required}} - # verify the required parameter "{{paramName}}" is set - if @api_client.config.client_side_validation && {{{paramName}}}.nil? - raise ArgumentError.new("Missing the required parameter '{{paramName}}' when calling {{classname}}.{{operationId}}") - end - {{#isEnum}} - {{^isContainer}} - # verify enum value - allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}] - if @api_client.config.client_side_validation && !allowable_values.includes?({{{paramName}}}) - raise ArgumentError.new("invalid value for \"{{{paramName}}}\", must be one of #{allowable_values}") - end - {{/isContainer}} - {{/isEnum}} - {{/required}} - {{/isNullable}} - {{^required}} - {{#isEnum}} - {{#collectionFormat}} - allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}] - if @api_client.config.client_side_validation && {{{paramName}}} && {{{paramName}}}.all? { |item| allowable_values.includes?(item) } - raise ArgumentError.new("invalid value for \"{{{paramName}}}\", must include one of #{allowable_values}") - end - {{/collectionFormat}} - {{^collectionFormat}} - allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}] - if @api_client.config.client_side_validation && {{{paramName}}} && !allowable_values.includes?({{{paramName}}}) - raise ArgumentError.new("invalid value for \"{{{paramName}}}\", must be one of #{allowable_values}") - end - {{/collectionFormat}} - {{/isEnum}} - {{/required}} - {{#hasValidation}} - {{#maxLength}} - if @api_client.config.client_side_validation && {{^required}}!{{{paramName}}}.nil? && {{/required}}{{{paramName}}}.to_s.size > {{{maxLength}}} - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, the character length must be smaller than or equal to {{{maxLength}}}.") - end - - {{/maxLength}} - {{#minLength}} - if @api_client.config.client_side_validation && {{^required}}!{{{paramName}}}.nil? && {{/required}}{{{paramName}}}.to_s.size < {{{minLength}}} - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, the character length must be greater than or equal to {{{minLength}}}.") - end - - {{/minLength}} - {{#maximum}} - if @api_client.config.client_side_validation && {{^required}}!{{{paramName}}}.nil? && {{/required}}{{{paramName}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.") - end - - {{/maximum}} - {{#minimum}} - if @api_client.config.client_side_validation && {{^required}}!{{{paramName}}}.nil? && {{/required}}{{{paramName}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.") - end - - {{/minimum}} - {{#pattern}} - pattern = Regexp.new({{{pattern}}}) - if @api_client.config.client_side_validation && {{^required}}{{{paramName}}}.nil? && {{/required}}{{{paramName}}} !~ pattern - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern #{pattern}.") - end - - {{/pattern}} - {{#maxItems}} - if @api_client.config.client_side_validation && {{^required}}{{{paramName}}}.nil? && {{/required}}{{{paramName}}}.size > {{{maxItems}}} - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{{maxItems}}}.") - end - - {{/maxItems}} - {{#minItems}} - if @api_client.config.client_side_validation && {{^required}}{{{paramName}}}.nil? && {{/required}}{{{paramName}}}.size < {{{minItems}}} - raise ArgumentError.new("invalid value for \"{{{paramName}}}\" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{{minItems}}}.") - end - {{/minItems}} - {{/hasValidation}} - {{/allParams}} - # resource path - local_var_path = "{{{path}}}"{{#pathParams}}.sub("{" + "{{baseName}}" + "}", URI.encode_path({{paramName}}.to_s){{^strictSpecBehavior}}.gsub("%2F", "/"){{/strictSpecBehavior}}){{/pathParams}} - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - {{#queryParams}} - query_params["{{{baseName}}}"] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}) unless {{{paramName}}}.nil?{{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.to_s unless {{{paramName}}}.nil?{{/collectionFormat}} - {{/queryParams}} - - # header parameters - header_params = Hash(String, String).new - {{#hasProduces}} - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept([{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]) - {{/hasProduces}} - {{#hasConsumes}} - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type([{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}]) - {{/hasConsumes}} - {{#headerParams}} - header_params["{{{baseName}}}"] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}} - {{/headerParams}} - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - {{#formParams}} - form_params[:"{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}} unless {{{paramName}}}.nil?{{/collectionFormat}} - {{/formParams}} - - # http body (model) - post_body = {{#bodyParam}}{{{paramName}}}.to_json{{/bodyParam}}{{^bodyParam}}nil{{/bodyParam}} - - # auth_names - auth_names = {{#authMethods}}{{#-first}}[{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{#-last}}]{{/-last}}{{/authMethods}}{{^authMethods}}[] of String{{/authMethods}} - - data, status_code, headers = @api_client.call_api( - http_method: :{{httpMethod}}, - path: local_var_path, - operation: :"{{classname}}.{{operationId}}", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: {{classname}}#{{operationId}}\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return {{#returnType}}{{{.}}}.from_json(data){{/returnType}}{{^returnType}}nil{{/returnType}}, status_code, headers + # {{summary}}{{#notes}} {{notes}}{{/notes}} +{{#isDeprecated}} @[Deprecated("This operation is marked deprecated in the OpenAPI spec.")] +{{/isDeprecated}} def {{operationId}}({{#pathParams}}{{paramName}} : {{{vendorExtensions.x-cr-data-type}}}{{^-last}}, {{/-last}}{{/pathParams}}{{#bodyParam}}{{#hasPathParams}}, {{/hasPathParams}}{{paramName}} : {{{vendorExtensions.x-cr-data-type}}}{{^required}}? = nil{{/required}}{{/bodyParam}}{{#hasFormParams}}{{#hasPathParams}}, {{/hasPathParams}}{{#bodyParam}}, {{/bodyParam}}{{#formParams}}{{paramName}} : {{{vendorExtensions.x-cr-data-type}}}? = nil{{^-last}}, {{/-last}}{{/formParams}}{{/hasFormParams}}{{#vendorExtensions.x-cr-has-named-params}}{{#hasPathParams}}, *, {{/hasPathParams}}{{^hasPathParams}}{{#bodyParam}}, *, {{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}, *, {{/hasFormParams}}{{^hasFormParams}}*, {{/hasFormParams}}{{/bodyParam}}{{/hasPathParams}}{{#headerParams}}{{paramName}} : {{{vendorExtensions.x-cr-data-type}}}? = nil{{^-last}}, {{/-last}}{{/headerParams}}{{#vendorExtensions.x-cr-has-header-params}}{{#hasQueryParams}}, {{/hasQueryParams}}{{/vendorExtensions.x-cr-has-header-params}}{{#queryParams}}{{paramName}} : {{{vendorExtensions.x-cr-data-type}}}? = nil{{^-last}}, {{/-last}}{{/queryParams}}{{#vendorExtensions.x-cr-has-cookie-params}}{{#headerParams.0}}, {{/headerParams.0}}{{^headerParams.0}}{{#hasQueryParams}}, {{/hasQueryParams}}{{/headerParams.0}}{{#cookieParams}}{{paramName}} : {{{vendorExtensions.x-cr-data-type}}}? = nil{{^-last}}, {{/-last}}{{/cookieParams}}{{/vendorExtensions.x-cr-has-cookie-params}}{{/vendorExtensions.x-cr-has-named-params}}) : Response({{#returnType}}{{{vendorExtensions.x-cr-return-type}}}{{/returnType}}{{^returnType}}Nil{{/returnType}}) + @conn.request({{#returnType}}{{{vendorExtensions.x-cr-return-type}}}{{/returnType}}{{^returnType}}Nil{{/returnType}}, + method: :{{httpMethod}}, + path: "{{{path}}}"{{#pathParams}}.sub("{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", {{moduleName}}.enc({{paramName}})){{/pathParams}}, +{{#bodyParam}} body: {{paramName}}, +{{/bodyParam}}{{#vendorExtensions.x-cr-has-header-or-cookie}} header: { {{#headerParams}}"{{baseName}}" => {{paramName}}.try &.to_s{{^-last}}, {{/-last}}{{/headerParams}}{{#vendorExtensions.x-cr-has-cookie-params}}{{#headerParams.0}}, {{/headerParams.0}}"Cookie" => [{{#cookieParams}}{{paramName}}.try { |v| "{{baseName}}=#{v}" }{{^-last}}, {{/-last}}{{/cookieParams}}].compact.join("; ").presence{{/vendorExtensions.x-cr-has-cookie-params}} }, +{{/vendorExtensions.x-cr-has-header-or-cookie}}{{#hasQueryParams}} query: { {{#queryParams}}"{{baseName}}" => {{paramName}}{{#vendorExtensions.x-cr-join-sep}}.try(&.map(&.to_s).join("{{{vendorExtensions.x-cr-join-sep}}}")){{/vendorExtensions.x-cr-join-sep}}{{^-last}}, {{/-last}}{{/queryParams}} }, +{{/hasQueryParams}}{{#hasFormParams}} form: Hash(String, Crest::ParamsValue){ {{#formParams}}"{{baseName}}" => {{paramName}}{{^-last}}, {{/-last}}{{/formParams}} }, +{{/hasFormParams}} accept: %w[{{#produces}}{{{mediaType}}}{{^-last}} {{/-last}}{{/produces}}], +{{#hasBodyParam}} content_type: %w[{{#consumes}}{{{mediaType}}}{{^-last}} {{/-last}}{{/consumes}}], +{{/hasBodyParam}}{{#vendorExtensions.x-cr-raw-body}} raw: true, +{{/vendorExtensions.x-cr-raw-body}} auth: %w[{{#authMethods}}{{name}}{{^-last}} {{/-last}}{{/authMethods}}]) end -{{^-last}} - -{{/-last}} {{/operation}} end -{{/operations}} +{{#apiNamespacePresent}} end +{{/apiNamespacePresent}}{{/operations}} end diff --git a/modules/openapi-generator/src/main/resources/crystal/api_client.mustache b/modules/openapi-generator/src/main/resources/crystal/api_client.mustache deleted file mode 100644 index dc3cb6872de3..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/api_client.mustache +++ /dev/null @@ -1,175 +0,0 @@ -# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} - -require "json" -require "time" - -module {{moduleName}} - class ApiClient - # The Configuration object holding settings to be used in the API client. - property config : Configuration - - # Defines the headers to be used in HTTP requests of all API calls by default. - # - # @return [Hash] - property default_headers : Hash(String, String) - - # Initializes the ApiClient - # @option config [Configuration] Configuration for initializing the object, default to Configuration.default - def initialize(@config = Configuration.default) - @user_agent = "{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/#{VERSION}/crystal{{/httpUserAgent}}" - @default_headers = { - "User-Agent" => @user_agent - } - end - - def self.default - @@default ||= ApiClient.new - end - - # Check if the given MIME is a JSON MIME. - # JSON MIME examples: - # application/json - # application/json; charset=UTF8 - # APPLICATION/JSON - # */* - # @param [String] mime MIME - # @return [Boolean] True if the MIME is application/json - def json_mime?(mime) - (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? - end - - - def build_request_url(path : String, operation : Symbol) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, "/") - @config.base_url(operation) + path - end - - # Update header and query params based on authentication settings. - # - # @param [Hash] header_params Header parameters - # @param [Hash] query_params Query parameters - # @param [String] auth_names Authentication scheme name - def update_params_for_auth!(header_params, query_params, cookie_params, auth_names) - auth_names.each do |auth_name| - auth_setting = @config.auth_settings[auth_name] - next unless auth_setting - case auth_setting[:in] - when "header" then header_params[auth_setting[:key]] = auth_setting[:value] - when "query" then query_params[auth_setting[:key]] = auth_setting[:value] - when "cookie" then cookie_params[auth_setting[:key]] = auth_setting[:value] - else raise ArgumentError.new("Authentication token must be in `cookie`, `query` or `header`") - end - end - end - - # Sets user agent in HTTP header - # - # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) - def user_agent=(user_agent) - @user_agent = user_agent - @default_headers["User-Agent"] = @user_agent - end - - # Return Accept header based on an array of accepts provided. - # @param [Array] accepts array for Accept - # @return [String] the Accept header (e.g. application/json) - def select_header_accept(accepts) : String - #return nil if accepts.nil? || accepts.empty? - # use JSON when present, otherwise use all of the provided - json_accept = accepts.find { |s| json_mime?(s) } - if json_accept.nil? - accepts.join(",") - else - json_accept - end - end - - # Return Content-Type header based on an array of content types provided. - # @param [Array] content_types array for Content-Type - # @return [String] the Content-Type header (e.g. application/json) - def select_header_content_type(content_types) - # use application/json by default - return "application/json" if content_types.nil? || content_types.empty? - # use JSON when present, otherwise use the first one - json_content_type = content_types.find { |s| json_mime?(s) } - json_content_type || content_types.first - end - - # Build parameter value according to the given collection format. - # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi - def build_collection_param(param, collection_format) - case collection_format - when :csv - param.join(",") - when :ssv - param.join(" ") - when :tsv - param.join("\t") - when :pipes - param.join("|") - when :multi - param - else - raise "unknown collection format: #{collection_format.inspect}" - end - end - - # Call an API with given options. - # - # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: - # the data deserialized from response body (could be nil), response status code and response headers. - def call_api(http_method : Symbol, path : String, operation : Symbol, post_body : String?, auth_names = [] of String, header_params = {} of String => String, query_params = {} of String => String, cookie_params = {} of String => String, form_params = {} of Symbol => (String | ::File)) - #ssl_options = { - # :ca_file => @config.ssl_ca_file, - # :verify => @config.ssl_verify, - # :verify_mode => @config.ssl_verify_mode, - # :client_cert => @config.ssl_client_cert, - # :client_key => @config.ssl_client_key - #} - - update_params_for_auth! header_params, query_params, cookie_params, auth_names - - if !post_body.nil? && !post_body.empty? - # use JSON string in the payload - form_or_body = post_body - else - # use HTTP forms in the payload - # TODO use HTTP form encoding - form_or_body = form_params - end - - request = Crest::Request.new( - method: http_method, - url: build_request_url(path, operation), - params: query_params, - headers: header_params, - cookies: cookie_params, - form: form_or_body, - logging: @config.debugging, - handle_errors: false, - params_encoder: {{{paramsEncoder}}} - ) - - response = request.execute - - if @config.debugging - Log.debug {"HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"} - end - - if !response.success? - if response.status == 0 - # Errors from libcurl will be made visible here - raise ApiError.new(code: 0, - message: response.body) - else - raise ApiError.new(code: response.status_code, - response_headers: response.headers, - message: response.body) - end - end - - return response.body, response.status_code, response.headers - end - end -end diff --git a/modules/openapi-generator/src/main/resources/crystal/api_doc.mustache b/modules/openapi-generator/src/main/resources/crystal/api_doc.mustache deleted file mode 100644 index e02ac96a0bd7..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/api_doc.mustache +++ /dev/null @@ -1,118 +0,0 @@ -# {{moduleName}}::{{classname}}{{#description}} - -{{.}}{{/description}} - -All URIs are relative to *{{basePath}}* - -| Method | HTTP request | Description | -| ------ | ------------ | ----------- | -{{#operations}} -{{#operation}} -| [**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} | -{{/operation}} -{{/operations}} - -{{#operations}} -{{#operation}} - -## {{operationId}} - -> {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}} - -{{{summary}}}{{#notes}} - -{{{.}}}{{/notes}} - -### Examples - -```ruby -require 'time' -require '{{{gemName}}}' -{{#hasAuthMethods}} -# setup authorization -{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - # Configure HTTP basic authorization: {{{name}}} - config.username = 'YOUR USERNAME' - config.password = 'YOUR PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}} - # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}} - config.access_token = 'YOUR_BEARER_TOKEN'{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - # Configure API key authorization: {{{name}}} - config.api_key['{{{keyParamName}}}'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) - # config.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} - # Configure OAuth2 access token for authorization: {{{name}}} - config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}} -{{/authMethods}}end -{{/hasAuthMethods}} - -api_instance = {{{moduleName}}}::{{{classname}}}.new -{{#requiredParams}} -{{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}} -{{/requiredParams}} -{{#optionalParams}} -{{#-first}} -opts = { -{{/-first}} - {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}} -{{#-last}} -} -{{/-last}} -{{/optionalParams}} - -begin - {{#summary}}# {{{.}}}{{/summary}} - {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}} - {{#returnType}} - p result - {{/returnType}} -rescue {{{moduleName}}}::ApiError => e - puts "Error when calling {{classname}}->{{{operationId}}}: #{e}" -end -``` - -#### Using the {{operationId}}_with_http_info variant - -This returns an Array which contains the response data{{^returnType}} (`nil` in this case){{/returnType}}, status code and headers. - -> {{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Integer, Hash)> {{operationId}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}} - -```ruby -begin - {{#summary}}# {{{.}}}{{/summary}} - data, status_code, headers = api_instance.{{{operationId}}}_with_http_info{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}} - p status_code # => 2xx - p headers # => { ... } - p data # => {{#returnType}}{{#returnTypeIsPrimitive}}{{returnType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}<{{{returnType}}}>{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil{{/returnType}} -rescue {{{moduleName}}}::ApiError => e - puts "Error when calling {{classname}}->{{{operationId}}}_with_http_info: #{e}" -end -``` - -### Parameters - -{{^allParams}} -This endpoint does not need any parameter. -{{/allParams}} -{{#allParams}} -{{#-first}} -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -{{/-first}} -| **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} | -{{/allParams}} - -### Return type - -{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}} - -### Authorization - -{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} - -### HTTP request headers - -- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} -- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} - -{{/operation}} -{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/crystal/api_error.mustache b/modules/openapi-generator/src/main/resources/crystal/api_error.mustache index 52678bd87821..12d46ac27349 100644 --- a/modules/openapi-generator/src/main/resources/crystal/api_error.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/api_error.mustache @@ -3,31 +3,44 @@ module {{moduleName}} class ApiError < Exception getter code : Int32? - getter response_headers : Hash(String, Array(String) | String)? + getter response_headers : HTTP::Headers? # Usage examples: # ApiError.new # ApiError.new(message: "message") - # ApiError.new(code: 500, response_headers: {}, message: "") + # ApiError.new(code: 500, response_headers: HTTP::Headers.new, message: "") # ApiError.new(code: 404, message: "Not Found") - def initialize(@code , @message, @response_headers) + def initialize(@code : Int32?, @response_headers : HTTP::Headers?, message : String?) + super(message) end - def initialize(@code , @message) + def initialize(@code : Int32?, @response_headers : HTTP::Headers?, body : String) + msg = body.empty? ? "the server returns an error but the HTTP response body is empty." : body + super(msg) + @message = msg + end + + def initialize(message : String) + super(message) + @code = nil + @response_headers = nil + end + + def initialize + super(nil) + @code = nil + @response_headers = nil end # Override to_s to display a friendly error message - def to_s - msg = "" - msg = msg + "\nHTTP status code: #{code}" if @code - msg = msg + "\nResponse headers: #{response_headers}" if @response_headers - if @message.try &.empty? - msg = msg + "\nError message: the server returns an error but the HTTP response body is empty." + def to_s(io : IO) : Nil + io << "\nHTTP status code: #{code}" if @code + io << "\nResponse headers: #{response_headers}" if @response_headers + if message.nil? || message.try &.empty? + io << "\nError message: the server returns an error but the HTTP response body is empty." else - msg = msg + "\nResponse body: #{@message}" + io << "\nResponse body: #{message}" end - - msg end end end diff --git a/modules/openapi-generator/src/main/resources/crystal/api_info.mustache b/modules/openapi-generator/src/main/resources/crystal/api_info.mustache index be6dda917018..c7fa37f0d659 100644 --- a/modules/openapi-generator/src/main/resources/crystal/api_info.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/api_info.mustache @@ -2,10 +2,6 @@ #{{{.}}} {{/appName}} -{{#appDescription}} -#{{{.}}} - -{{/appDescription}} {{#version}}The version of the OpenAPI document: {{.}}{{/version}} {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}} Generated by: https://openapi-generator.tech diff --git a/modules/openapi-generator/src/main/resources/crystal/api_test.mustache b/modules/openapi-generator/src/main/resources/crystal/api_test.mustache index 059f66f11f51..b0061d69c0b7 100644 --- a/modules/openapi-generator/src/main/resources/crystal/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/api_test.mustache @@ -1,37 +1,19 @@ # {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} -require "../spec_helper" +require "{{specHelperPath}}" # Unit tests for {{moduleName}}::{{classname}} # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate {{#operations}} Spectator.describe "{{classname}}" do - describe "test an instance of {{classname}}" do - it "should create an instance of {{classname}}" do - api_instance = {{moduleName}}::{{classname}}.new - expect(api_instance).to be_instance_of({{moduleName}}::{{classname}}) - end + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = {{moduleName}}::Client.new(host: "localhost") + instance = {{moduleName}}::{{classname}}.new(client.connection) + expect(instance).to be_a({{moduleName}}::{{classname}}) end - -{{#operation}} - # unit tests for {{operationId}} - {{#summary}} - # {{.}} - {{/summary}} - {{#notes}} - # {{.}} - {{/notes}} -{{#allParams}}{{#required}} # @param {{paramName}} {{description}} -{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters -{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}} -{{/required}}{{/allParams}} # @return [{{{returnType}}}{{^returnType}}nil{{/returnType}}] - describe "{{operationId}} test" do - skip "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - -{{/operation}} end {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/crystal/base_object.mustache b/modules/openapi-generator/src/main/resources/crystal/base_object.mustache deleted file mode 100644 index 4ee4a276ca0f..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/base_object.mustache +++ /dev/null @@ -1,41 +0,0 @@ - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - {{#vars}} - hash["{{{baseName}}}"] = _to_h({{{name}}}) - {{/vars}} - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end - end diff --git a/modules/openapi-generator/src/main/resources/crystal/client.mustache b/modules/openapi-generator/src/main/resources/crystal/client.mustache new file mode 100644 index 000000000000..14f8a6c9e268 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/crystal/client.mustache @@ -0,0 +1,38 @@ +# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} + +module {{moduleName}} + class Client + getter connection : Connection + + def initialize(*, host : String, token : String? = nil, scheme : String = "https") + cfg = Configuration.new + cfg.host = host + cfg.scheme = scheme + cfg.access_token = token if token + @connection = Connection.new(cfg) + end + + def initialize(@connection : Connection); end +{{#crNamespaces}} + def {{name}} : {{className}} + @{{name}} ||= {{className}}.new(@connection) + end + + @{{name}} : {{className}}? +{{/crNamespaces}} + end +{{#crNamespaces}} + + class {{className}} + def initialize(@conn : Connection); end +{{#resources}} + + def {{accessor}} : {{className}} + @{{accessor}} ||= {{className}}.new(@conn) + end + + @{{accessor}} : {{className}}? +{{/resources}} + end +{{/crNamespaces}} +end diff --git a/modules/openapi-generator/src/main/resources/crystal/configuration.mustache b/modules/openapi-generator/src/main/resources/crystal/configuration.mustache index ace95a8b28fe..3d3f7ab506fc 100644 --- a/modules/openapi-generator/src/main/resources/crystal/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/configuration.mustache @@ -1,5 +1,8 @@ # {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} +require "base64" +require "crest" +require "http" require "log" module {{moduleName}} @@ -13,18 +16,6 @@ module {{moduleName}} # Defines url base path property base_path : String - # Define server configuration index - property server_index : Int32 - - # Define server operation configuration index - property server_operation_index : Hash(Symbol, String) - - # Default server variables - property server_variables : Hash(Symbol, String) - - # Default server operation variables - property server_operation_variables : Hash(Symbol, String) - # Defines API keys used with API Key authentications. # # @return [Hash] key: parameter name, value: parameter value (API key) @@ -61,6 +52,15 @@ module {{moduleName}} # @return [true, false] property debugging : Bool + # Enable the underlying HTTP client's (crest) request/response logging. Off by default, so the + # shard produces no log output unless a consumer opts in (e.g. a higher-level client wrapper + # can expose `config.logging = true`). Independent of `debugging`. + property logging : Bool + + # Logger used by crest when `logging` is enabled. Defaults to `Crest::CommonLogger`; assign a + # custom `Crest::Logger` to control formatting/output. + property logger : Crest::Logger + # Defines the temporary folder to store downloaded files # (for API endpoints that have file response). # Default to use `Tempfile`. @@ -119,25 +119,28 @@ module {{moduleName}} # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 #property params_encoding : String? + # Default headers sent with every request. + property default_headers : HTTP::Headers = HTTP::Headers.new + + # Params encoder used to encode array query parameters. + # Default: Crest::NestedParamsEncoder (encodes arrays as key=a&key=b). + property params_encoder : Crest::ParamsEncoder.class = {{paramsEncoder}} + # Create a new `Configuration`. def initialize @scheme = "{{scheme}}" @host = "{{host}}{{#port}}:{{{.}}}{{/port}}" @base_path = "{{contextPath}}" - @server_index = 0 - @server_operation_index = {} of Symbol => String - @server_variables = {} of Symbol => String - @server_operation_variables = {} of Symbol => String @api_key = {} of Symbol => String @api_key_prefix = {} of Symbol => String @timeout = 0 @client_side_validation = true - @verify_ssl = true - @verify_ssl_host = true #@params_encoding = nil #@cert_file = nil #@key_file = nil @debugging = false + @logging = false + @logger = Crest::CommonLogger.new @username = nil @password = nil @access_token = nil @@ -147,7 +150,7 @@ module {{moduleName}} # Create a new `Configuration` with block. # # ``` - # config = Petstore::Configuration.new do |config| + # config = {{moduleName}}::Configuration.new do |config| # config.username = "xxx" # config.password = "xxx" # end @@ -183,13 +186,9 @@ module {{moduleName}} @base_path = "" if @base_path == "/" end - # Returns base URL for specified operation based on server settings - def base_url(operation = Nil) - # TODO revise below to support operation-level server setting - #index = server_operation_index.fetch(operation, server_index) - return "#{scheme}://#{[host, base_path].join("/").gsub(/\/+/, "/")}".sub(/\/+\z/, "") #if index == Nil - - #server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + # Returns the base URL for requests. + def base_url + "#{scheme}://#{[host, base_path].join("/").gsub(/\/+/, "/")}".sub(/\/+\z/, "") end # Gets API key (with prefix if set). @@ -204,170 +203,46 @@ module {{moduleName}} # Gets Basic Auth token string def basic_auth_token - "Basic " + ["#{username}:#{password}"].pack("m").delete("\r\n") + "Basic " + Base64.strict_encode("#{username}:#{password}") end - # Returns Auth Settings hash for api client. - def auth_settings -{{#authMethods.0}} - Hash{ + # Applies authentication credentials to request headers and query params. + # Called by Connection#request for every outgoing request. + def apply_auth!(headers : HTTP::Headers, params : Hash(String, String | Array(String)), auth_names : Array(String)) : Nil {{#authMethods}} {{#isApiKey}} - "{{name}}" => { - type: "api_key", - in: {{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}{{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}, - key: "{{keyParamName}}", - value: api_key_with_prefix(:{{keyParamName}}) - }, + if auth_names.includes?("{{name}}") + value = api_key_with_prefix(:"{{keyParamName}}") + unless value.empty? + {{#isKeyInHeader}}headers["{{keyParamName}}"] = value{{/isKeyInHeader}}{{#isKeyInQuery}}params["{{keyParamName}}"] = value{{/isKeyInQuery}}{{#isKeyInCookie}}headers["Cookie"] = [headers["Cookie"]?, "{{keyParamName}}=#{value}"].compact.join("; "){{/isKeyInCookie}} + end + end {{/isApiKey}} {{#isBasic}} {{#isBasicBasic}} - "{{name}}" => { - type: "basic", - in: "header", - key: "Authorization", - value: basic_auth_token - }, + if auth_names.includes?("{{name}}") + if @username || @password + headers["Authorization"] = basic_auth_token + end + end {{/isBasicBasic}} {{#isBasicBearer}} - "{{name}}" => { - type: "bearer", - in: "header", - {{#bearerFormat}} - format: "{{{.}}}", - {{/bearerFormat}} - key: "Authorization", - value: "Bearer #{access_token}" - }, + if auth_names.includes?("{{name}}") + if token = @access_token + headers["Authorization"] = "Bearer #{token}" + end + end {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} - "{{name}}" => { - type: "oauth2", - in: "header", - key: "Authorization", - value: "Bearer #{access_token}" - }, + if auth_names.includes?("{{name}}") + if token = @access_token + headers["Authorization"] = "Bearer #{token}" + end + end {{/isOAuth}} {{/authMethods}} - } -{{/authMethods.0}} -{{^authMethods}} - {} of String => Hash(Symbol, String) -{{/authMethods}} - end - - # Returns an array of Server setting - def server_settings - [ - {{#servers}} - { - url: "{{{url}}}", - description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - variables: { - {{/-first}} - "{{{name}}}": { - description: "{{{description}}}{{^description}}No description provided{{/description}}", - default_value: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - enum_values: [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{/servers}} - ] - end - - def operation_server_settings - {{#apiInfo}} - {{#apis}} - {{#operations}} - {{#operation}} - {{#servers}} - {{#-first}} - { - "{{{classname}}}.{{{nickname}}}": [ - {{/-first}} - { - url: "{{{url}}}", - description: "{{{description}}}{{^description}}No description provided{{/description}}", - {{#variables}} - {{#-first}} - variables: { - {{/-first}} - "{{{name}}}": { - description: "{{{description}}}{{^description}}No description provided{{/description}}", - default_value: "{{{defaultValue}}}", - {{#enumValues}} - {{#-first}} - enum_values: [ - {{/-first}} - "{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - {{/-last}} - {{/enumValues}} - }{{^-last}},{{/-last}} - {{#-last}} - } - {{/-last}} - {{/variables}} - }{{^-last}},{{/-last}} - {{#-last}} - ], - } - {{/-last}} - {{/servers}} - {{/operation}} - {{/operations}} - {{/apis}} - {{/apiInfo}} end - # Returns URL based on server settings - # - # @param index array index of the server settings - # @param variables hash of variable and the corresponding value - def server_url(index, variables = {} of Symbol => String, servers = Nil) - servers = server_settings if servers == Nil - - # check array index out of bound - if (index < 0 || index >= servers.size) - raise ArgumentError.new("Invalid index #{index} when selecting the server. Must be less than #{servers.size}") - end - - server = servers[index] - url = server[:url] - - return url unless server.has_key? :variables - - # go through variable and assign a value - server[:variables].each do |name, variable| - if variables.has_key?(name) - if (!server[:variables][name].has_key?(:enum_values) || server[:variables][name][:enum_values].includes?(variables[name])) - url.gsub! "{" + name.to_s + "}", variables[name] - else - raise ArgumentError.new("The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}.") - end - else - # use default value - url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] - end - end - - url - end end end diff --git a/modules/openapi-generator/src/main/resources/crystal/connection.mustache b/modules/openapi-generator/src/main/resources/crystal/connection.mustache new file mode 100644 index 000000000000..fef36492ccbd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/crystal/connection.mustache @@ -0,0 +1,96 @@ +require "crest" +require "json" +require "log" +require "uri" + +module {{moduleName}} + Log = ::Log.for("{{shardName}}") + + def self.enc(value) : String + URI.encode_path_segment(value.to_s) + end + + class Connection + getter config : Configuration + + def initialize(@config : Configuration); end + + def request(klass : T.class, *, method : Symbol, path : String, + body = nil, query : Hash(String, _)? = nil, + form : Hash(String, Crest::ParamsValue)? = nil, + header : Hash(String, String?)? = nil, + accept : Array(String) = %w[application/json], + content_type : Array(String) = %w[application/json], + auth : Array(String) = %w[], + raw : Bool = false) : Response(T) forall T + Log.debug { "#{method} #{path}" } if config.debugging + + headers = config.default_headers.dup + header.try &.each { |k, v| headers[k] = v unless v.nil? } + # Prefer a JSON media type when the operation offers one: the body is always + # JSON-decoded (T.from_json), so requesting application/xml first (as some specs + # list it) would yield a response we can't parse. + headers["Accept"] = (accept.find(&.includes?("json")) || accept.first) unless accept.empty? + q = {} of String => String | Array(String) + query.try &.each do |k, v| + next if v.nil? + case v + when Array then q[k] = v.map(&.to_s) + else q[k] = v.to_s + end + end + config.apply_auth!(headers, q, auth) + + # Determine what to pass as the form/body argument to Crest + # If there's a JSON body, serialize it and pass as raw string form + body_str : String? = body.nil? ? nil : body.to_json + headers["Content-Type"] = content_type.first if body_str && !content_type.empty? + + crest_form : Hash(String, Crest::ParamsValue) | String | Nil = + if body_str + body_str + elsif form && !form.empty? + form + else + nil + end + + headers_hash = {} of String => String | Array(String) + headers.each { |k, vs| headers_hash[k] = vs.size == 1 ? vs.first : vs } + + resp = Crest::Request.execute( + method, + config.base_url + path, + crest_form, + headers: headers_hash, + params: q, + params_encoder: config.params_encoder, + logging: config.logging, + logger: config.logger, + handle_errors: false) + + resp_headers = to_http_headers(resp.headers) + unless 200 <= resp.status_code < 300 + raise ApiError.new(resp.status_code, resp_headers, resp.body) + end + + # `raw` (set by operations whose response isn't JSON, e.g. text/plain or binary) returns the + # body untouched; a String return type is otherwise JSON-decoded (unquoted). + value = {% if T == Nil %} nil {% elsif T == String %} (raw ? resp.body : String.from_json(resp.body)) {% else %} T.from_json(resp.body) {% end %} + Response(T).new(value, resp.status_code, resp_headers) + end + + # Crest returns headers as a Hash whose values may be a String or an Array(String); + # convert to the idiomatic HTTP::Headers used by Response/ApiError. + private def to_http_headers(raw) : HTTP::Headers + headers = HTTP::Headers.new + raw.each do |key, value| + case value + when Array then value.each { |v| headers.add(key, v) } + else headers[key] = value.to_s + end + end + headers + end + end +end diff --git a/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache b/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache index 1a7e69fd1cdb..15f3b69381a3 100644 --- a/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache @@ -12,3 +12,6 @@ /shard.lock /tmp/ + +# Spectator run artifact +.spectator-failures diff --git a/modules/openapi-generator/src/main/resources/crystal/model.mustache b/modules/openapi-generator/src/main/resources/crystal/model.mustache index 2de5ed1b7780..a6a7b4beb91d 100644 --- a/modules/openapi-generator/src/main/resources/crystal/model.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/model.mustache @@ -15,8 +15,16 @@ module {{moduleName}} {{/-first}} {{/oneOf}} {{^oneOf}} +{{#anyOf}} +{{#-first}} +{{>partial_model_anyof}} + +{{/-first}} +{{/anyOf}} +{{^anyOf}} {{>partial_model_generic}} +{{/anyOf}} {{/oneOf}} {{/isEnum}} {{/model}} diff --git a/modules/openapi-generator/src/main/resources/crystal/model_doc.mustache b/modules/openapi-generator/src/main/resources/crystal/model_doc.mustache deleted file mode 100644 index 6b4fb320f695..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/model_doc.mustache +++ /dev/null @@ -1,14 +0,0 @@ -{{#models}} -{{#model}} -{{#oneOf}} -{{#-first}} -{{>partial_oneof_module_doc}} - -{{/-first}} -{{/oneOf}} -{{^oneOf}} -{{>partial_model_generic_doc}} - -{{/oneOf}} -{{/model}} -{{/models}} diff --git a/modules/openapi-generator/src/main/resources/crystal/model_test.mustache b/modules/openapi-generator/src/main/resources/crystal/model_test.mustache index 04743fcb6784..0c3da07c9c98 100644 --- a/modules/openapi-generator/src/main/resources/crystal/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/model_test.mustache @@ -9,61 +9,88 @@ require "../spec_helper" {{#model}} Spectator.describe {{moduleName}}::{{classname}} do {{^oneOf}} - - describe "test an instance of {{classname}}" do - skip "should create an instance of {{classname}}" do - #instance = {{moduleName}}::{{classname}}.new - #expect(instance).to be_instance_of({{moduleName}}::{{classname}}) +{{^isEnum}} +{{^anyOf}} +{{#vendorExtensions.x-cr-not-json-serializable}} + describe "JSON contract" do + # This model holds a non-JSON-serialisable property (e.g. a ::File field), so a + # from_json round-trip cannot be compiled. Assert the JSON contract is present instead. + it "defines from_json" do + expect({{moduleName}}::{{classname}}.responds_to?(:from_json)).to be_true + end + end +{{/vendorExtensions.x-cr-not-json-serializable}} +{{^vendorExtensions.x-cr-not-json-serializable}} +{{#vendorExtensions.x-cr-discriminator-map}} + describe "polymorphic JSON" do + # A discriminated base type dispatches to a mapped subtype, so it cannot be built from a + # document that omits the discriminator field. + it "requires the discriminator to deserialise" do + expect { {{moduleName}}::{{classname}}.from_json("{}") }.to raise_error end end -{{#vars}} - describe "test attribute '{{{name}}}'" do - skip "should work" do - {{#isEnum}} - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - # validator = Petstore::EnumTest::EnumAttributeValidator.new("{{{dataType}}}", [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]) - # validator.allowable_values.each do |value| - # expect { instance.{{name}} = value }.not_to raise_error - # end - {{/isEnum}} - {{^isEnum}} - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - {{/isEnum}} +{{/vendorExtensions.x-cr-discriminator-map}} +{{^vendorExtensions.x-cr-discriminator-map}} +{{^hasRequired}} + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = {{moduleName}}::{{classname}}.from_json("{}") + expect(instance).to be_a({{moduleName}}::{{classname}}) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) end end -{{/vars}} -{{/oneOf}} -{{#oneOf}} + describe "#to_h" do + it "returns a Hash representation" do + instance = {{moduleName}}::{{classname}}.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +{{/hasRequired}} +{{#hasRequired}} + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { {{moduleName}}::{{classname}}.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +{{/hasRequired}} +{{/vendorExtensions.x-cr-discriminator-map}} +{{/vendorExtensions.x-cr-not-json-serializable}} +{{/anyOf}} +{{#anyOf}} {{#-first}} - describe ".openapi_one_of" do - it "lists the items referenced in the oneOf array" do - expect(described_class.openapi_one_of).to_not be_empty + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect({{moduleName}}::{{classname}}.responds_to?(:from_json)).to be_true end end - - {{#discriminator}} - {{#propertyName}} - describe ".openapi_discriminator_name" do - it "returns the value of the "discriminator" property" do - expect(described_class.openapi_discriminator_name).to_not be_empty +{{/-first}} +{{/anyOf}} +{{/isEnum}} +{{#isEnum}} + describe "JSON round-trip" do + it "parses an allowed value" do + value = {{moduleName}}::{{classname}}.from_json(%({{#allowableValues}}{{#enumVars}}{{#-first}}{{{value}}}{{/-first}}{{/enumVars}}{{/allowableValues}})) + expect(value).to be_a({{moduleName}}::{{classname}}) end end - - {{/propertyName}} - {{#mappedModels}} - {{#-first}} - describe ".openapi_discriminator_mapping" do - it "returns the key/values of the "mapping" property" do - expect(described_class.openapi_discriminator_mapping.values.sort).to eq(described_class.openapi_one_of.sort) +{{/isEnum}} +{{/oneOf}} +{{#oneOf}} +{{#-first}} + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect({{moduleName}}::{{classname}}.openapi_one_of).to_not be_empty end end - {{/-first}} - {{/mappedModels}} - {{/discriminator}} describe ".build" do - skip "returns the correct model" do + it "is defined on the oneOf union type" do + expect({{moduleName}}::{{classname}}.responds_to?(:build)).to be_true end end {{/-first}} diff --git a/modules/openapi-generator/src/main/resources/crystal/partial_model_anyof.mustache b/modules/openapi-generator/src/main/resources/crystal/partial_model_anyof.mustache new file mode 100644 index 000000000000..e11e05c9f841 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/crystal/partial_model_anyof.mustache @@ -0,0 +1,68 @@ + {{#description}} + # {{{.}}} + {{/description}} + # {{classname}} (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class {{classname}} + getter value + + {{#anyOf}} + def initialize(@value : {{{.}}}) + end + {{/anyOf}} + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}} + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json +{{#vendorExtensions.x-cr-discriminator-prop}} + # discriminator fast-path: pick the mapped member by the discriminator value. + if (disc_h = data.as_h?) && (disc = disc_h["{{{vendorExtensions.x-cr-discriminator-prop}}}"]?.try(&.as_s?)) + case disc +{{#discriminator}}{{#mappedModels}} when "{{{mappingName}}}" then return new({{{modelName}}}.from_json(json)) +{{/mappedModels}}{{/discriminator}} else + # unknown discriminator value: fall through to trying each member + end + end +{{/vendorExtensions.x-cr-discriminator-prop}} + {{#anyOf}} + begin + return new({{{.}}}.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + {{/anyOf}} + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in {{classname}} (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + {{#anyOf}} + begin + return new({{{.}}}.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + {{/anyOf}} + raise YAML::ParseException.new("doesn't match any schema listed in {{classname}} (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end diff --git a/modules/openapi-generator/src/main/resources/crystal/partial_model_enum_class.mustache b/modules/openapi-generator/src/main/resources/crystal/partial_model_enum_class.mustache index 02da11897ad4..6a378a3cb2e4 100644 --- a/modules/openapi-generator/src/main/resources/crystal/partial_model_enum_class.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/partial_model_enum_class.mustache @@ -1,22 +1,4 @@ - class {{classname}}{{#allowableValues}}{{#enumVars}} - {{{name}}} = {{{value}}} - {{/enumVars}} {{/allowableValues}} - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def self.build_from_hash(value) - new.build_from_hash(value) - end - - # Builds the enum from string - # @param [String] The enum value in the form of the string - # @return [String] The enum value - def build_from_hash(value) - case value{{#allowableValues}}{{#enumVars}} - when {{{value}}} - {{{name}}}{{/enumVars}}{{/allowableValues}} - else - raise "Invalid ENUM value #{value} for class #{{{classname}}}" - end - end - end \ No newline at end of file + # {{classname}} (OpenAPI enum). Allowed values: {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}. + # Represented as `{{dataType}}` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias {{classname}} = {{dataType}} diff --git a/modules/openapi-generator/src/main/resources/crystal/partial_model_generic.mustache b/modules/openapi-generator/src/main/resources/crystal/partial_model_generic.mustache index 8d0ded604024..77a47cb71d75 100644 --- a/modules/openapi-generator/src/main/resources/crystal/partial_model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/partial_model_generic.mustache @@ -4,86 +4,47 @@ class {{classname}}{{#parent}} < {{{.}}}{{/parent}} include JSON::Serializable include YAML::Serializable + include {{moduleName}}::Serializable + include {{moduleName}}::Validation + {{#vendorExtensions.x-cr-additional-properties}} + # Preserve unknown JSON keys (additionalProperties) across a (de)serialisation round-trip. + include JSON::Serializable::Unmapped + {{/vendorExtensions.x-cr-additional-properties}} + {{#vendorExtensions.x-cr-discriminator-map}} + + # Polymorphic (de)serialisation: dispatch on the discriminator to the mapped subtype. + use_json_discriminator "{{vendorExtensions.x-cr-discriminator-prop}}", {{{vendorExtensions.x-cr-discriminator-map}}} + use_yaml_discriminator "{{vendorExtensions.x-cr-discriminator-prop}}", {{{vendorExtensions.x-cr-discriminator-map}}} + {{/vendorExtensions.x-cr-discriminator-map}} {{#hasRequired}} # Required properties {{/hasRequired}} {{#requiredVars}} + {{^vendorExtensions.x-cr-inherited}} {{#description}} # {{{.}}} {{/description}} - @[JSON::Field(key: "{{{baseName}}}", type: {{{dataType}}}{{#defaultValue}}, default: {{{defaultValue}}}{{/defaultValue}}, nillable: false, emit_null: false)] + @[JSON::Field(key: "{{{baseName}}}", emit_null: false)] property {{{name}}} : {{{dataType}}} + {{/vendorExtensions.x-cr-inherited}} {{/requiredVars}} {{#hasOptional}} # Optional properties {{/hasOptional}} {{#optionalVars}} + {{^vendorExtensions.x-cr-inherited}} {{#description}} # {{{.}}} {{/description}} - @[JSON::Field(key: "{{{baseName}}}", type: {{{dataType}}}?{{#defaultValue}}, default: {{{defaultValue}}}{{/defaultValue}}, nillable: true, emit_null: false)] - property {{{name}}} : {{{dataType}}}? + @[JSON::Field(key: "{{{baseName}}}", emit_null: false)] + property {{{name}}} : {{{dataType}}}?{{#vendorExtensions.x-cr-default}} = {{{vendorExtensions.x-cr-default}}}{{/vendorExtensions.x-cr-default}} + {{/vendorExtensions.x-cr-inherited}} {{/optionalVars}} -{{#hasEnums}} - abstract class EnumAttributeValidator - def valid?(value) - !value || @allowable_values.includes?(value) - end - - def message - "invalid value for \"#{@attribute}\", must be one of #{@allowable_values}." - end - - def to(_type, value) - case _type - when Int32 - value.to_i32 - when Int64 - value.to_i64 - when Float32 - value.to_f32 - when Float64 - value.to_f64 - else - value.to_s - end - end - end - - {{#vars}} - {{#isEnum}} - {{^isContainer}} - class EnumAttributeValidatorFor{{#lambdaPascalcase}}{{{name}}}{{/lambdaPascalcase}} < EnumAttributeValidator - @attribute : String - @allowable_values : Array(Int32 | Int64 | Float32 | Float64 | String) - - def initialize - @attribute = "{{{name}}}" - @allowable_values = [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}].map { |value| to({{{dataType}}}, value)} - end - end - - {{/isContainer}} - {{/isEnum}} - {{/vars}} - -{{/hasEnums}} - {{#anyOf}} - {{#-first}} - # List of class defined in anyOf (OpenAPI v3) - def self.openapi_any_of - [ - {{/-first}} - :"{{{.}}}"{{^-last}},{{/-last}} - {{#-last}} - ] - end - - {{/-last}} - {{/anyOf}} +{{#vars}}{{#vendorExtensions.x-cr-validated}}{{^isContainer}}{{^vendorExtensions.x-cr-inherited}} validates({{{name}}}, {{{dataType}}}, {{#required}}false{{/required}}{{^required}}true{{/required}}{{#isEnum}}, enum: [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]{{/isEnum}}{{#maxLength}}, max_length: {{{maxLength}}}{{/maxLength}}{{#minLength}}, min_length: {{{minLength}}}{{/minLength}}{{#maximum}}, maximum: {{{maximum}}}{{#exclusiveMaximum}}, exclusive_maximum: true{{/exclusiveMaximum}}{{/maximum}}{{#minimum}}, minimum: {{{minimum}}}{{#exclusiveMinimum}}, exclusive_minimum: true{{/exclusiveMinimum}}{{/minimum}}{{#pattern}}, pattern: {{{pattern}}}{{/pattern}}{{#maxItems}}, max_items: {{{maxItems}}}{{/maxItems}}{{#minItems}}, min_items: {{{minItems}}}{{/minItems}}) +{{/vendorExtensions.x-cr-inherited}}{{/isContainer}}{{/vendorExtensions.x-cr-validated}}{{/vars}} {{#allOf}} {{#-first}} # List of class defined in allOf (OpenAPI v3) @@ -108,69 +69,24 @@ {{/discriminator}} # Initializes the object # @param [Hash] attributes Model attributes in the form of hash - def initialize({{#requiredVars}}@{{{name}}} : {{{dataType}}}{{^-last}}, {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}@{{{name}}} : {{{dataType}}}? = nil{{^-last}}, {{/-last}}{{/optionalVars}}) - end + def initialize({{#requiredVars}}{{^vendorExtensions.x-cr-inherited}}@{{/vendorExtensions.x-cr-inherited}}{{{name}}} : {{{dataType}}}{{^-last}}, {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{^vendorExtensions.x-cr-inherited}}@{{/vendorExtensions.x-cr-inherited}}{{{name}}} : {{{dataType}}}? = {{#vendorExtensions.x-cr-default}}{{{vendorExtensions.x-cr-default}}}{{/vendorExtensions.x-cr-default}}{{^vendorExtensions.x-cr-default}}nil{{/vendorExtensions.x-cr-default}}{{^-last}}, {{/-last}}{{/optionalVars}}) +{{#parent}} super({{{vendorExtensions.x-cr-parent-args}}}) +{{/parent}} end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = {{^parent}}Array(String).new{{/parent}}{{#parent}}super{{/parent}} {{#vars}} - {{#isEnum}} + {{#vendorExtensions.x-cr-validated}} {{^isContainer}} - {{{name}}}_validator = EnumAttributeValidatorFor{{#lambdaPascalcase}}{{{name}}}{{/lambdaPascalcase}}.new - if !{{{name}}}_validator.valid?(@{{{name}}}) - message = {{{name}}}_validator.message - invalid_properties.push(message) + {{^vendorExtensions.x-cr-inherited}} + if (msg = {{{name}}}_validation_error(@{{{name}}})) + invalid_properties.push(msg) end - + {{/vendorExtensions.x-cr-inherited}} {{/isContainer}} - {{/isEnum}} - {{#hasValidation}} - {{#maxLength}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.to_s.try &.size.try &.> {{{maxLength}}} - invalid_properties.push("invalid value for \"{{{name}}}\", the character length must be smaller than or equal to {{{maxLength}}}.") - end - - {{/maxLength}} - {{#minLength}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.to_s.try &.size.try &.< {{{minLength}}} - invalid_properties.push("invalid value for \"{{{name}}}\", the character length must be greater than or equal to {{{minLength}}}.") - end - - {{/minLength}} - {{#maximum}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.>{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} - invalid_properties.push("invalid value for \"{{{name}}}\", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.") - end - - {{/maximum}} - {{#minimum}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.<{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} - invalid_properties.push("invalid value for \"{{{name}}}\", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.") - end - - {{/minimum}} - {{#pattern}} - pattern = {{{pattern}}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.!~ pattern - invalid_properties.push("invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}.") - end - - {{/pattern}} - {{#maxItems}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.size.try &.> {{{maxItems}}} - invalid_properties.push("invalid value for \"{{{name}}}\", number of items must be less than or equal to {{{maxItems}}}." - end - - {{/maxItems}} - {{#minItems}} - if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.size.try &.< {{{minItems}}} - invalid_properties.push("invalid value for \"{{{name}}}\", number of items must be greater than or equal to {{{minItems}}}." - end - - {{/minItems}} - {{/hasValidation}} + {{/vendorExtensions.x-cr-validated}} {{/vars}} invalid_properties end @@ -178,145 +94,9 @@ # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - {{#vars}} - {{#isEnum}} - {{^isContainer}} - {{{name}}}_validator = EnumAttributeValidatorFor{{#lambdaPascalcase}}{{{name}}}{{/lambdaPascalcase}}.new - return false unless {{{name}}}_validator.valid?(@{{{name}}}) - {{/isContainer}} - {{/isEnum}} - {{#hasValidation}} - {{#maxLength}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.to_s.try &.size.try &.> {{{maxLength}}} - {{/maxLength}} - {{#minLength}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.to_s.try &.size.try &.< {{{minLength}}} - {{/minLength}} - {{#maximum}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.>{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} - {{/maximum}} - {{#minimum}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.<{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} - {{/minimum}} - {{#pattern}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.!~ {{{pattern}}} - {{/pattern}} - {{#maxItems}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.size.try &.> {{{maxItems}}} - {{/maxItems}} - {{#minItems}} - return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.try &.size.try &.< {{{minItems}}} - {{/minItems}} - {{/hasValidation}} - {{/vars}} - {{#anyOf}} - {{#-first}} - _any_of_found = false - self.class.openapi_any_of.each do |_class| - _any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_h) - if _any_of.valid? - _any_of_found = true - end - end - - if !_any_of_found - return false - end - - {{/-first}} - {{/anyOf}} - true{{#parent}} && super{{/parent}} + list_invalid_properties.empty? end - {{#vars}} - {{#isEnum}} - {{^isContainer}} - # Custom attribute writer method checking allowed values (enum). - # @param [Object] {{{name}}} Object to be assigned - def {{{name}}}=({{{name}}}) - validator = EnumAttributeValidatorFor{{#lambdaPascalcase}}{{{name}}}{{/lambdaPascalcase}}.new - unless validator.valid?({{{name}}}) - raise ArgumentError.new(validator.message) - end - @{{{name}}} = {{{name}}} - end - - {{/isContainer}} - {{/isEnum}} - {{^isEnum}} - {{#hasValidation}} - # Custom attribute writer method with validation - # @param [Object] {{{name}}} Value to be assigned - def {{{name}}}=({{{name}}}) - {{#maxLength}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.size > {{{maxLength}}} - raise ArgumentError.new("invalid value for \"{{{name}}}\", the character length must be smaller than or equal to {{{maxLength}}}.") - end - - {{/maxLength}} - {{#minLength}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.size < {{{minLength}}} - raise ArgumentError.new("invalid value for \"{{{name}}}\", the character length must be greater than or equal to {{{minLength}}}.") - end - - {{/minLength}} - {{#maximum}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} - raise ArgumentError.new("invalid value for \"{{{name}}}\", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.") - end - - {{/maximum}} - {{#minimum}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} - raise ArgumentError.new("invalid value for \"{{{name}}}\", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.") - end - - {{/minimum}} - {{#pattern}} - pattern = {{{pattern}}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} !~ pattern - raise ArgumentError.new("invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}.") - end - - {{/pattern}} - {{#maxItems}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.size > {{{maxItems}}} - raise ArgumentError.new("invalid value for \"{{{name}}}\", number of items must be less than or equal to {{{maxItems}}}.") - end - - {{/maxItems}} - {{#minItems}} - if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.size < {{{minItems}}} - raise ArgumentError.new("invalid value for \"{{{name}}}\", number of items must be greater than or equal to {{{minItems}}}.") - end - - {{/minItems}} - @{{{name}}} = {{{name}}} - end - - {{/hasValidation}} - {{/isEnum}} - {{/vars}} - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class{{#vars}} && - {{name}} == other.{{name}}{{/vars}}{{#parent}} && super(other){{/parent}} - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [{{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}].hash - end - -{{> base_object}} - +{{#hasVars}} def_equals_and_hash({{#vars}}{{{name}}}{{^-last}}, {{/-last}}{{/vars}}) +{{/hasVars}} end diff --git a/modules/openapi-generator/src/main/resources/crystal/partial_model_generic_doc.mustache b/modules/openapi-generator/src/main/resources/crystal/partial_model_generic_doc.mustache deleted file mode 100644 index 95bdb7107c22..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/partial_model_generic_doc.mustache +++ /dev/null @@ -1,28 +0,0 @@ -# {{moduleName}}::{{classname}} - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -{{#vars}} -| **{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#isReadOnly}}[readonly]{{/isReadOnly}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} | -{{/vars}} - -## Example - -```ruby -require '{{{gemName}}}' - -{{^vars}} -instance = {{moduleName}}::{{classname}}.new() -{{/vars}} -{{#vars}} -{{#-first}} -instance = {{moduleName}}::{{classname}}.new( -{{/-first}} - {{name}}: {{example}}{{^-last}},{{/-last}} -{{#-last}} -) -{{/-last}} -{{/vars}} -``` diff --git a/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module.mustache b/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module.mustache index f18cd6f6d9cd..9febc79ebc23 100644 --- a/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module.mustache @@ -1,104 +1,77 @@ {{#description}} # {{{.}}} {{/description}} + # {{classname}} (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. class {{classname}} - include JSON::Serializable - include YAML::Serializable + getter value - class SchemaMismatchError < Exception + {{#oneOf}} + def initialize(@value : {{{.}}}) end + {{/oneOf}} - {{#oneOf}} - {{#-first}} - # List of class defined in oneOf (OpenAPI v3) + # List of classes defined in oneOf (OpenAPI v3) def self.openapi_one_of [ - {{/-first}} - {{{.}}}{{^-last}},{{/-last}} - {{#-last}} + {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}} ] end - {{/-last}} - {{/oneOf}} - - {{#discriminator}} - use_yaml_discriminator {{#propertyName}}"{{{.}}}"{{/propertyName}}, { - {{#mappedModels}}{{{mappingName}}}: {{{modelName}}}{{^-last}},{{/-last}}{{/mappedModels}} - } - {{/discriminator}} - - def self.build(data) - openapi_one_of.each do |klass| - begin - typed_data = find_and_cast_into_type(klass, data) - return typed_data if typed_data - rescue ex - # rescue all errors so we keep iterating even if the current item lookup raises - Log.trace { ex.message } - end - end - - nil + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) end - {{#oneOf}} - private def self.find_and_cast_into_type(klass : {{{.}}}.class, data) - return if data.nil? - - Log.trace { "INSPECTING DATA" } - Log.trace { data.inspect } + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end - case data - when NetboxClient::RecursiveHash - if value = cast_value(array_data: false, array_class: array_class?(klass), klass: klass, data: data) - return new(value) + def self.from_json_any(data : JSON::Any) : self + json = data.to_json +{{#vendorExtensions.x-cr-discriminator-prop}} + # discriminator fast-path: pick the mapped member by the discriminator value. + if (disc_h = data.as_h?) && (disc = disc_h["{{{vendorExtensions.x-cr-discriminator-prop}}}"]?.try(&.as_s?)) + case disc +{{#discriminator}}{{#mappedModels}} when "{{{mappingName}}}" then return new({{{modelName}}}.from_json(json)) +{{/mappedModels}}{{/discriminator}} else + # unknown discriminator value: fall through to trying each member end - when Array(NetboxClient::RecursiveHash) - if value = cast_value(array_data: true, array_class: array_class?(klass), klass: klass, data: data) - return new(value) - end - else - raise SchemaMismatchError.new("#{data} doesn't match the #{klass} type") end - end - {{/oneOf}} - - private def self.cast_value(array_data : Bool, array_class : Bool, klass, data) - if array_class == true && array_data == true - Log.debug { "Building array of classes: #{klass} / #{data}" } - - klass.from_json(data.to_json) - elsif array_class == false && array_data == false - Log.debug { "Building single class: #{klass} / #{data}" } - - klass.from_json(data.to_json) +{{/vendorExtensions.x-cr-discriminator-prop}} + {{#oneOf}} + begin + return new({{{.}}}.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError end + {{/oneOf}} + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in {{classname}} (oneOf)", 0, 0) end - private def self.array_class?(klass) - klass.name.starts_with?("Array(") + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil end - {{#oneOf}} - def initialize(@value : {{{.}}}) + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + {{#oneOf}} + begin + return new({{{.}}}.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + {{/oneOf}} + raise YAML::ParseException.new("doesn't match any schema listed in {{classname}} (oneOf)", 0, 0) end - {{/oneOf}} - - delegate :to_yaml, to: @value - delegate :to_json, to: @value - - def to_any_h - {"value" => to_h} + def to_json(builder : JSON::Builder) + @value.to_json(builder) end - def to_h - val = @value - if val.is_a?(Int32) - val - else - val.to_h - end + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) end end diff --git a/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module_doc.mustache b/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module_doc.mustache deleted file mode 100644 index 64a6c32dc854..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/partial_oneof_module_doc.mustache +++ /dev/null @@ -1,92 +0,0 @@ -# {{moduleName}}::{{classname}} - -## Class instance methods - -### `openapi_one_of` - -Returns the list of classes defined in oneOf. - -#### Example - -```ruby -require '{{{gemName}}}' - -{{moduleName}}::{{classname}}.openapi_one_of -# => -{{#oneOf}} -{{#-first}} -# [ -{{/-first}} -# :'{{{.}}}'{{^-last}},{{/-last}} -{{#-last}} -# ] -{{/-last}} -{{/oneOf}} -``` -{{#discriminator}} -{{#propertyName}} - -### `openapi_discriminator_name` - -Returns the discriminator's property name. - -#### Example - -```ruby -require '{{{gemName}}}' - -{{moduleName}}::{{classname}}.openapi_discriminator_name -# => :'{{{.}}}' -``` -{{/propertyName}} -{{#mappedModels}} -{{#-first}} - -### `openapi_discriminator_name` - -Returns the discriminator's mapping. - -#### Example - -```ruby -require '{{{gemName}}}' - -{{moduleName}}::{{classname}}.openapi_discriminator_mapping -# => -# { -{{/-first}} -# :'{{{mappingName}}}' => :'{{{modelName}}}'{{^-last}},{{/-last}} -{{#-last}} -# } -{{/-last}} -{{/mappedModels}} -{{/discriminator}} - -### build - -Find the appropriate object from the `openapi_one_of` list and casts the data into it. - -#### Example - -```ruby -require '{{{gemName}}}' - -{{moduleName}}::{{classname}}.build(data) -# => {{#oneOf}}{{#-first}}#<{{{.}}}:0x00007fdd4aab02a0>{{/-first}}{{/oneOf}} - -{{moduleName}}::{{classname}}.build(data_that_doesnt_match) -# => nil -``` - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| **data** | **Mixed** | data to be matched against the list of oneOf items | - -#### Return type - -{{#oneOf}} -- `{{{.}}}` -{{/oneOf}} -- `nil` (if no type matches) diff --git a/modules/openapi-generator/src/main/resources/crystal/recursive_hash.mustache b/modules/openapi-generator/src/main/resources/crystal/recursive_hash.mustache deleted file mode 100644 index 7d682f48af51..000000000000 --- a/modules/openapi-generator/src/main/resources/crystal/recursive_hash.mustache +++ /dev/null @@ -1,18 +0,0 @@ -module {{moduleName}} - # Define possible value types for our own AnyHash class (RecursiveHash) - alias ValuesType = Nil | - Bool | - String | - Time | - Int32 | - Int64 | - Float32 | - Float64 | - Array(ValuesType) - - # Define our own AnyHash class (RecursiveHash) - # RecursiveHash - AnyHash.define_new klass: :RecursiveHash, - key: String, - value: ValuesType -end diff --git a/modules/openapi-generator/src/main/resources/crystal/response.mustache b/modules/openapi-generator/src/main/resources/crystal/response.mustache new file mode 100644 index 000000000000..ed4b12933e76 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/crystal/response.mustache @@ -0,0 +1,13 @@ +module {{moduleName}} + struct Response(T) + getter value : T + getter status : Int32 + getter headers : HTTP::Headers + + def initialize(@value : T, @status : Int32, @headers : HTTP::Headers); end + + def success? : Bool + 200 <= @status < 300 + end + end +end diff --git a/modules/openapi-generator/src/main/resources/crystal/serializable.mustache b/modules/openapi-generator/src/main/resources/crystal/serializable.mustache new file mode 100644 index 000000000000..223f3f9d1cfa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/crystal/serializable.mustache @@ -0,0 +1,27 @@ +# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} +require "json" + +module {{moduleName}} + # Shared serialization helpers mixed into every generated model. + module Serializable + # Returns the string representation of the object + def to_s(io : IO) : Nil + io << to_json + end + + # to_body is an alias to to_h (backward compatibility) + def to_body : Hash(String, JSON::Any) + to_h + end + + # Returns the object in the form of hash + def to_h : Hash(String, JSON::Any) + JSON.parse(to_json).as_h + end + + # @see the `==` method + def eql?(other) + self == other + end + end +end diff --git a/modules/openapi-generator/src/main/resources/crystal/shard.mustache b/modules/openapi-generator/src/main/resources/crystal/shard.mustache index 08a392a1a491..c4ab3c3a5c5e 100644 --- a/modules/openapi-generator/src/main/resources/crystal/shard.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/shard.mustache @@ -11,8 +11,6 @@ description: | crystal: ">= 0.35.1" dependencies: - any_hash: - github: Sija/any_hash.cr crest: github: mamantoha/crest version: ~> 1.3.13 diff --git a/modules/openapi-generator/src/main/resources/crystal/shard_name.mustache b/modules/openapi-generator/src/main/resources/crystal/shard_name.mustache index 85e39816da44..ec6008ccc211 100644 --- a/modules/openapi-generator/src/main/resources/crystal/shard_name.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/shard_name.mustache @@ -1,37 +1,23 @@ # {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} - -# Stdlib dependencies require "big" +require "big/json" require "json" require "log" require "time" +require "uri" require "yaml" -# External dependencies -require "any_hash" -require "crest" - -module {{moduleName}} - Log = ::Log.for("{{moduleName}}") # => Log for {{moduleName}} source - - VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }} - - # Return the default `Configuration` object. - def self.configure - Configuration.default - end - - # Customize default settings for the SDK using block. - # - # ``` - # {{moduleName}}.configure do |config| - # config.username = "xxx" - # config.password = "xxx" - # end - # ``` - def self.configure - yield Configuration.default - end -end +require "./{{shardName}}/configuration" +require "./{{shardName}}/connection" +require "./{{shardName}}/response" +require "./{{shardName}}/api_error" +require "./{{shardName}}/client" +require "./{{shardName}}/serializable" +require "./{{shardName}}/validation" -require "./{{shardName}}/**" +# Models +{{#models}}{{#model}}require "./{{shardName}}/models/{{classFilename}}" +{{/model}}{{/models}} +# APIs +{{#apiInfo}}{{#apis}}require "./{{shardName}}/api/{{classFilename}}" +{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/crystal/validation.mustache b/modules/openapi-generator/src/main/resources/crystal/validation.mustache new file mode 100644 index 000000000000..afa8a85b48cd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/crystal/validation.mustache @@ -0,0 +1,33 @@ +# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}} +{{=<% %>=}} +module <%moduleName%> + # Shared macro for declarative property validation. Include it in a model and + # declare `validates(name, Type, nilable, **rules)` per validated property. + # Supported rule keys: enum, max_length, min_length, maximum, exclusive_maximum, + # minimum, exclusive_minimum, pattern, max_items, min_items. + module Validation + macro validates(name, klass, nilable, **rules) + {% if rules[:enum] %}{{name.id.upcase}}_ALLOWED = {{rules[:enum]}}{% end %} + + def {{name.id}}=(value : {{klass}}{% if nilable %}?{% end %}) + if (msg = {{name.id}}_validation_error(value)) + raise ArgumentError.new(msg) + end + @{{name.id}} = value + end + + def {{name.id}}_validation_error(value) : String? + {% if rules[:enum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be one of #{ {{name.id.upcase}}_ALLOWED }" unless value.nil? || {{name.id.upcase}}_ALLOWED.includes?(value) + {% end %}{% if rules[:max_length] %}return "invalid value for \"#{ {{name.stringify}} }\", the character length must be smaller than or equal to {{rules[:max_length]}}." if value.try &.to_s.try &.size.try &.> {{rules[:max_length]}} + {% end %}{% if rules[:min_length] %}return "invalid value for \"#{ {{name.stringify}} }\", the character length must be greater than or equal to {{rules[:min_length]}}." if value.try &.to_s.try &.size.try &.< {{rules[:min_length]}} + {% end %}{% if rules[:maximum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be smaller than{% if rules[:exclusive_maximum] %}{% else %} or equal to{% end %} {{rules[:maximum]}}." if value.try &.>{% if rules[:exclusive_maximum] %}={% end %} {{rules[:maximum]}} + {% end %}{% if rules[:minimum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be greater than{% if rules[:exclusive_minimum] %}{% else %} or equal to{% end %} {{rules[:minimum]}}." if value.try &.<{% if rules[:exclusive_minimum] %}={% end %} {{rules[:minimum]}} + {% end %}{% if rules[:pattern] %}return "invalid value for \"#{ {{name.stringify}} }\", must conform to the pattern {{rules[:pattern]}}." if value.try &.!~ {{rules[:pattern]}} + {% end %}{% if rules[:max_items] %}return "invalid value for \"#{ {{name.stringify}} }\", number of items must be less than or equal to {{rules[:max_items]}}." if value.try &.size.try &.> {{rules[:max_items]}} + {% end %}{% if rules[:min_items] %}return "invalid value for \"#{ {{name.stringify}} }\", number of items must be greater than or equal to {{rules[:min_items]}}." if value.try &.size.try &.< {{rules[:min_items]}} + {% end %}nil + end + end + end +end +<%={{ }}=%> diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalApiRoutingTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalApiRoutingTest.java new file mode 100644 index 000000000000..063723828f53 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalApiRoutingTest.java @@ -0,0 +1,132 @@ +// CrystalApiRoutingTest.java +package org.openapitools.codegen.crystal; + +import org.openapitools.codegen.languages.crystal.CrystalApiRouting; +import org.testng.annotations.Test; +import java.util.*; +import static org.testng.Assert.assertEquals; + +public class CrystalApiRoutingTest { + + private static final List NETBOX = Arrays.asList( + "/api/dcim/cable-terminations/", "/api/dcim/cable-terminations/{id}/", + "/api/dcim/cable-terminations/{id}/paths/", "/api/ipam/vlans/{id}/"); + + private static final List QDRANT = Arrays.asList( + "/collections", "/collections/{collection_name}", + "/collections/{collection_name}/points/query", + "/collections/{collection_name}/points/{id}", + "/collections/{collection_name}/exists", + "/cluster/recover", "/cluster/peer/{peer_id}", "/"); + + @Test + public void testResourceSegmentsNetbox() { + Set r = CrystalApiRouting.resourceSegments(NETBOX); + assertEquals(r, new HashSet<>(Arrays.asList("cable-terminations", "vlans"))); + } + + @Test + public void testResourceSegmentsQdrant() { + Set r = CrystalApiRouting.resourceSegments(QDRANT); + assertEquals(r, new HashSet<>(Arrays.asList("collections", "points", "peer"))); + } + + @Test + public void testCommonBasePrefix() { + assertEquals(CrystalApiRouting.commonBasePrefix(NETBOX), "api"); + assertEquals(CrystalApiRouting.commonBasePrefix(QDRANT), ""); + } + + @Test + public void testLiterals() { + assertEquals(CrystalApiRouting.literals("/api/dcim/cable-terminations/{id}/paths/", "api"), + Arrays.asList("dcim", "cable-terminations", "paths")); + assertEquals(CrystalApiRouting.literals("/collections/{collection_name}/points/query", ""), + Arrays.asList("collections", "points", "query")); + assertEquals(CrystalApiRouting.literals("/", ""), Collections.emptyList()); + } + + @Test + public void testRouteNetboxItemUsesOperationIdAction() { + java.util.Set r = CrystalApiRouting.resourceSegments(NETBOX); + CrystalApiRouting.Route route = CrystalApiRouting.route( + "/api/dcim/cable-terminations/{id}/", "PATCH", + "dcim_cable_terminations_partial_update", r, "api"); + assertEquals(route.namespace, "dcim"); + assertEquals(route.resource, "cable-terminations"); + assertEquals(route.action, "partial_update"); + } + + @Test + public void testRouteQdrantActionSegment() { + java.util.Set r = CrystalApiRouting.resourceSegments(QDRANT); + CrystalApiRouting.Route route = CrystalApiRouting.route( + "/collections/{collection_name}/points/query", "POST", "query_points", r, ""); + assertEquals(route.namespace, "collections"); + assertEquals(route.resource, "points"); + assertEquals(route.action, "query"); // operationId "query_points" doesn't start with group prefix "points_", so branch (b) applies: last literal segment "query" + } + + @Test + public void testRouteDegenerateNoResource() { + java.util.Set r = CrystalApiRouting.resourceSegments(QDRANT); + CrystalApiRouting.Route route = CrystalApiRouting.route( + "/cluster/recover", "POST", "recover_cluster", r, ""); + assertEquals(route.namespace, "cluster"); + assertEquals(route.resource, null); + assertEquals(route.action, "recover"); + } + + @Test + public void testRouteVerbFallbackCollectionVsItem() { + java.util.Set r = CrystalApiRouting.resourceSegments(QDRANT); + // no operationId, no extra literal -> verb CRUD, collection-aware + CrystalApiRouting.Route coll = CrystalApiRouting.route("/collections", "GET", "", r, ""); + assertEquals(coll.namespace, "collections"); + assertEquals(coll.resource, null); + assertEquals(coll.action, "list"); + CrystalApiRouting.Route item = CrystalApiRouting.route("/collections/{collection_name}", "GET", "", r, ""); + assertEquals(item.action, "get"); + } + + @Test + public void testRouteRootPath() { + java.util.Set r = CrystalApiRouting.resourceSegments(QDRANT); + CrystalApiRouting.Route route = CrystalApiRouting.route("/", "GET", "", r, ""); + assertEquals(route.namespace, "root"); + assertEquals(route.resource, null); + // lits is empty for "/", no operationId, not an item path -> verbAction("GET", false) -> "list" + assertEquals(route.action, "list"); + } + + @Test + public void testRouteCamelCaseActionName() { + // /pet/findByStatus → action segment is camelCase; must be snake_cased + List petPaths = Arrays.asList("/pet", "/pet/{petId}", "/pet/findByStatus", "/pet/findByTags"); + java.util.Set r = CrystalApiRouting.resourceSegments(petPaths); + // findByStatus is not a resource (it never precedes a {param}), so it becomes an action literal + CrystalApiRouting.Route route = CrystalApiRouting.route( + "/pet/findByStatus", "GET", "findPetsByStatus", r, ""); + // operationId "findPetsByStatus" → underscore → "find_pets_by_status" + // group = "pet" (no resource since findByStatus ∉ r), group_ = "pet_" + // "find_pets_by_status" does not start with "pet_" ... so falls to (b): action literal = findByStatus → "find_by_status" + assertEquals(route.namespace, "pet"); + assertEquals(route.resource, null); + assertEquals(route.action, "find_by_status"); + } + + @Test + public void testRouteCamelCaseOperationId() { + // operationId with camelCase prefix strip: e.g. "petFindByStatus" from group "pet" + List petPaths = Arrays.asList("/pet", "/pet/{petId}", "/pet/findByStatus"); + java.util.Set r = CrystalApiRouting.resourceSegments(petPaths); + CrystalApiRouting.Route route = CrystalApiRouting.route( + "/pet/findByStatus", "GET", "petFindByStatus", r, ""); + // operationId "petFindByStatus" → underscore → "pet_find_by_status" + // group = "pet", g = "pet_" + // "pet_find_by_status".startsWith("pet_") and rest = "find_by_status" + assertEquals(route.namespace, "pet"); + assertEquals(route.resource, null); + assertEquals(route.action, "find_by_status"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalClientCodegenTest.java index b1ca249b9c76..bd67cd2e6290 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/crystal/CrystalClientCodegenTest.java @@ -28,6 +28,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.List; +import java.util.Map; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; @@ -53,15 +54,23 @@ public void testGenerateCrystalClientWithHtmlEntity() throws Exception { List files = generator.opts(clientOptInput).generate(); boolean apiFileGenerated = false; for (File file : files) { - if (file.getName().equals("default_api.cr")) { + // After namespaced routing + segment sanitization: + // /foo=bar -> namespace "foo=bar" -> sanitizeName strips '=' -> "foobar" -> file "foobar.cr" + if (file.getName().equals("foobar.cr")) { apiFileGenerated = true; - // Crystal client should set the path unescaped in the api file - assertTrue(FileUtils.readFileToString(file, StandardCharsets.UTF_8) - .contains("local_var_path = \"/foo=bar\"")); + String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8); + // Crystal client should set the path in the @conn.request call + assertTrue(content.contains("path: \"/foo=bar\"")); + // The generated class is nested under the api namespace module and its name must + // be valid Crystal (no '=' in identifier): `module Api` + `class Foobar`. + assertTrue(content.contains("module Api") && content.contains("class Foobar"), + "Generated class must be Api::Foobar (sanitized, no '=')"); + Assert.assertFalse(content.contains("Foo=bar"), + "Generated class name must not contain '=' (invalid Crystal identifier)"); } } if (!apiFileGenerated) { - fail("Default api file is not generated!"); + fail("API file is not generated!"); } } @@ -121,29 +130,29 @@ public void testBooleanDefaultValue() throws Exception { List files = generator.opts(clientOptInput).generate(); boolean apiFileGenerated = false; for (File file : files) { - if (file.getName().equals("default_api.cr")) { + // After namespaced routing: /default/Resources/{id} with commonBasePrefix="default/Resources" + // -> lits=[] -> namespace="root" -> file "root.cr" + if (file.getName().equals("root.cr")) { apiFileGenerated = true; - // Crystal client should set the path unescaped in the api file + // Crystal client should set the path in the @conn.request call assertTrue(FileUtils.readFileToString(file, StandardCharsets.UTF_8) - .contains("local_var_path = \"/default/Resources/{id}\"")); + .contains("path: \"/default/Resources/{id}\"")); } } if (!apiFileGenerated) { - fail("Default api file is not generated!"); + fail("API file is not generated!"); } } @Test - public void testAuthSettingsWithNoAuthMethodsEmitsValidCrystal() throws Exception { - // Regression test: when an OpenAPI spec has no recognized auth methods, - // the generated configuration.cr's auth_settings method must not emit - // a bare `Hash{}` literal, which is invalid Crystal. Crystal requires - // `{} of K => V` for empty hash literals. + public void testConfigurationHasNoAuthSettingsMethod() throws Exception { + // auth_settings was a dead utility method (not called by apply_auth!) and has + // been removed. Verify it is absent and apply_auth! is still present. final File output = Files.createTempDirectory("test").toFile(); output.mkdirs(); output.deleteOnExit(); - final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/2_0/pathWithHtmlEntity.yaml"); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); CodegenConfig codegenConfig = new CrystalClientCodegen(); codegenConfig.setOutputDir(output.getAbsolutePath()); @@ -156,16 +165,17 @@ public void testAuthSettingsWithNoAuthMethodsEmitsValidCrystal() throws Exceptio if (file.getName().equals("configuration.cr")) { configFileGenerated = true; String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8); - // Bug: the previous template emitted `Hash{\n }` for empty - // auth methods, which Crystal rejects with: - // Error: for empty hashes use '{} of KeyType => ValueType' - Assert.assertFalse(content.contains("Hash{\n }"), - "configuration.cr must not contain an empty `Hash{}` literal"); - Assert.assertFalse(content.contains("Hash{}"), - "configuration.cr must not contain an empty `Hash{}` literal"); - // Fix: emit a typed empty hash literal that compiles in Crystal. - assertTrue(content.contains("{} of String => Hash(Symbol, String)"), - "configuration.cr must emit a typed empty hash literal in auth_settings"); + // auth_settings has been removed (dead code — not called by apply_auth!) + Assert.assertFalse(content.contains("def auth_settings"), + "configuration.cr must not contain the removed auth_settings method"); + // apply_auth! is still present (the real auth entry point) + assertTrue(content.contains("def apply_auth!"), + "configuration.cr must still contain apply_auth!"); + // server machinery has been removed too + Assert.assertFalse(content.contains("def server_settings"), + "configuration.cr must not contain the removed server_settings method"); + Assert.assertFalse(content.contains("def server_url"), + "configuration.cr must not contain the removed server_url method"); } } if (!configFileGenerated) { @@ -174,44 +184,546 @@ public void testAuthSettingsWithNoAuthMethodsEmitsValidCrystal() throws Exceptio } @Test - public void testAuthSettingsWithAuthMethodsStillEmitsHashLiteral() throws Exception { - // Ensure the empty-auth fix did not regress the populated case. + public void testSanitizeModelName() throws Exception { + final CrystalClientCodegen codegen = new CrystalClientCodegen(); + codegen.setHideGenerationTimestamp(false); + codegen.processOpts(); + + Assert.assertEquals(codegen.sanitizeModelName("JSON::Any"), "JSON::Any"); + // Disallows single colons + Assert.assertEquals(codegen.sanitizeModelName("JSON:Any"), "JSONAny"); + } + + @Test + @SuppressWarnings("unchecked") + public void testNamespaceTreeAssembled() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CrystalClientCodegen codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + new DefaultGenerator().opts(new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + List> ns = (List>) codegen.additionalProperties().get("crNamespaces"); + assertTrue(ns != null && !ns.isEmpty(), "crNamespaces must be populated"); + + // Find the "pet" namespace entry + Map petNs = ns.stream() + .filter(m -> "pet".equals(m.get("name"))) + .findFirst() + .orElse(null); + assertTrue(petNs != null, "expected a 'pet' namespace in the tree"); + + // className must be produced by toApiName("pet") == "Api::Pet" + Assert.assertEquals(petNs.get("className"), "Api::Pet", + "pet namespace className must equal Api::Pet (produced by toApiName)"); + + // resources list must be present (may be empty if petstore has no sub-resource segments under pet) + List> resources = (List>) petNs.get("resources"); + assertTrue(resources != null, "pet namespace must have a resources list (may be empty)"); + + // Each resource entry must have a non-null accessor and a className starting with "Api::Pet" + for (Map res : resources) { + assertTrue(res.get("accessor") != null, "resource accessor must not be null"); + String resClassName = (String) res.get("className"); + assertTrue(resClassName != null && resClassName.startsWith("Api::Pet"), + "resource className must start with 'Api::Pet', got: " + resClassName); + } + } + + @Test + public void testRuntimeFilesGenerated() throws Exception { final File output = Files.createTempDirectory("test").toFile(); - output.mkdirs(); output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + File conn = files.stream().filter(f -> f.getName().equals("connection.cr")).findFirst().orElse(null); + assertTrue(conn != null, "connection.cr generated"); + String c = FileUtils.readFileToString(conn, StandardCharsets.UTF_8); + assertTrue(c.contains("def request(klass : T.class"), "generic request present"); + assertTrue(c.contains("forall T"), "request is generic"); + assertTrue(files.stream().anyMatch(f -> f.getName().equals("response.cr")), "response.cr generated"); + } + + @Test + public void testResourceMethodIsDeclarative() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + File pet = files.stream() + .filter(f -> f.getName().equals("pet.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")) + .findFirst().orElseThrow(() -> new AssertionError("api/pet.cr missing")); + String src = FileUtils.readFileToString(pet, StandardCharsets.UTF_8); + assertTrue(src.contains("module Api") && src.contains("class Pet"), "namespaced class (module Api + class Pet)"); + assertTrue(src.contains("@conn.request("), "delegates to Connection#request"); + Assert.assertFalse(src.contains("_with_http_info"), "no http_info twins"); + Assert.assertFalse(src.contains("client_side_validation"), "no dead validation"); + } + + @Test + public void testNamespacedFileAndClassNames() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); CodegenConfig codegenConfig = new CrystalClientCodegen(); codegenConfig.setOutputDir(output.getAbsolutePath()); + ClientOptInput input = new ClientOptInput().openAPI(openAPI).config(codegenConfig); + List files = new DefaultGenerator().opts(input).generate(); - ClientOptInput clientOptInput = new ClientOptInput().openAPI(openAPI).config(codegenConfig); + // petstore /pet, /pet/{petId} -> namespace "pet", file pet.cr (no /api prefix in petstore) + boolean found = files.stream().anyMatch(f -> + f.getPath().replace(File.separatorChar, '/').endsWith("/api/pet.cr")); + assertTrue(found, "expected a namespaced resource file src/.../api/pet.cr"); + } - DefaultGenerator generator = new DefaultGenerator(); - List files = generator.opts(clientOptInput).generate(); - boolean configFileGenerated = false; - for (File file : files) { - if (file.getName().equals("configuration.cr")) { - configFileGenerated = true; - String content = FileUtils.readFileToString(file, StandardCharsets.UTF_8); - assertTrue(content.contains("Hash{"), - "configuration.cr should still emit `Hash{` for populated auth methods"); - Assert.assertFalse(content.contains("{} of String => Hash(Symbol, String)"), - "configuration.cr should not emit empty hash literal when auth methods exist"); - } - } - if (!configFileGenerated) { - fail("configuration.cr file is not generated!"); + @Test + public void testFacadeGenerated() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + File client = files.stream().filter(f -> f.getName().equals("client.cr")) + .findFirst().orElseThrow(() -> new AssertionError("client.cr missing")); + String src = FileUtils.readFileToString(client, StandardCharsets.UTF_8); + assertTrue(src.contains("class Client"), "facade class"); + assertTrue(src.contains("def pet"), "lazy namespace accessor for pet"); + assertTrue(src.contains("Connection.new"), "builds a Connection"); + } + + /** + * Regression test for api.mustache defects: + * 1. Trailing comma in method signatures (e.g. "def foo(pet_id : Int64, )") + * 2. Duplicated splat separator ("*, *,") + * 3. Trailing space in %w[] arrays producing spurious empty element + * 4. Form params not declared in method signature / body references undeclared params + */ + @Test + public void testNamespacingEdgeCases() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/namespacing.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + // /store/orders + /store/orders/{id} -> orders precedes {id} -> resource + // groupKey="store/orders" -> file .../api/store/orders.cr, class Api::Store::Orders + assertTrue(files.stream().anyMatch(f -> f.getPath().replace(File.separatorChar, '/').endsWith("/store/orders.cr")), + "store/orders.cr must be generated (orders is a resource segment)"); + + // /store/refresh -> refresh not in R -> action on namespace "store" -> groupKey="store" + // file .../api/store.cr must contain def refresh + File store = files.stream().filter(f -> f.getName().equals("store.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")).findFirst().orElse(null); + assertTrue(store != null, "store.cr (degenerate action on store namespace) must be generated"); + assertTrue(FileUtils.readFileToString(store, StandardCharsets.UTF_8).contains("def refresh"), + "store.cr must contain def refresh (action derived from operationId store_refresh)"); + + // /ping -> lits=["ping"] (basePrefix="" since paths diverge at root) -> namespace="ping" + // Design: route() returns namespace="ping", not "root" (root only for empty-lits case) + // -> groupKey="ping" -> file .../api/ping.cr + assertTrue(files.stream().anyMatch(f -> f.getName().equals("ping.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")), + "ping.cr must be generated for /ping (namespace 'ping', not 'root', since lits is non-empty)"); + } + + @Test + public void testApiMustacheSignaturesAndArrays() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + // Collect all generated API .cr files + List apiFiles = files.stream() + .filter(f -> f.getName().endsWith(".cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")) + .collect(java.util.stream.Collectors.toList()); + assertTrue(!apiFiles.isEmpty(), "At least one API .cr file must be generated"); + + for (File apiFile : apiFiles) { + String src = FileUtils.readFileToString(apiFile, StandardCharsets.UTF_8); + String fname = apiFile.getName(); + + // DEFECT 1: No trailing comma before closing paren in method signatures + Assert.assertFalse(src.contains(", )"), + fname + ": found trailing comma in method signature: ', )'"); + + // DEFECT 2: No duplicated splat separator + Assert.assertFalse(src.contains("*, *,"), + fname + ": found duplicated splat separator '*, *,'"); + + // DEFECT 5: No trailing space in %w[] arrays + // A trailing space before ] means a spurious empty string element e.g. %w[foo ] + Assert.assertFalse(src.contains(" ]"), + fname + ": found trailing space before ']' in %w[] array (spurious empty element)"); } + + // DEFECT 3+4: Form params must be declared in signature and referenced in form: body + // Find pet.cr - it has updatePetWithForm (path+form) and uploadFile (path+form) + File pet = files.stream() + .filter(f -> f.getName().equals("pet.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")) + .findFirst().orElseThrow(() -> new AssertionError("api/pet.cr missing")); + String petSrc = FileUtils.readFileToString(pet, StandardCharsets.UTF_8); + + // updatePetWithForm: path param petId + form params name + status + // The form: { ... } body must reference declared variables name and status + assertTrue(petSrc.contains("form: Hash(String, Crest::ParamsValue){"), + "pet.cr: expected a typed form hash for form-param operations"); + // The form body must reference "name" and "status" as local variables (not string literals) + // Specifically: form: { "name" => name, "status" => status } + assertTrue(petSrc.contains("\"name\" => name"), + "pet.cr: form body must reference declared param 'name'"); + assertTrue(petSrc.contains("\"status\" => status"), + "pet.cr: form body must reference declared param 'status'"); + + // The method declaration for updatePetWithForm must include name and status as params + // We check that the form param names appear in the def line before the form: call + // A simple proxy: the file must contain "name : " (form param declaration) + assertTrue(petSrc.contains("name : "), + "pet.cr: form param 'name' must be declared in method signature"); + + // uploadFile: path param petId + form params additionalMetadata + file + // baseName is "additionalMetadata" (camelCase from spec), variable is snake_cased + assertTrue(petSrc.contains("\"additionalMetadata\" => additional_metadata"), + "pet.cr: uploadFile form body must reference declared param 'additional_metadata'"); } @Test - public void testSanitizeModelName() throws Exception { - final CrystalClientCodegen codegen = new CrystalClientCodegen(); - codegen.setHideGenerationTimestamp(false); - codegen.processOpts(); + public void testModelsIncludeSerializableMixin() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CrystalClientCodegen codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put("moduleName", "Petstore"); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + assertTrue(files.stream().anyMatch(f -> f.getName().equals("serializable.cr")), + "serializable.cr (shared mixin) must be generated"); + File pet = files.stream().filter(f -> f.getPath().replace(File.separatorChar,'/').endsWith("/models/pet.cr")) + .findFirst().orElseThrow(() -> new AssertionError("pet.cr missing")); + String src = FileUtils.readFileToString(pet, StandardCharsets.UTF_8); + assertTrue(src.contains("include Petstore::Serializable"), "model must include the mixin"); + Assert.assertFalse(src.contains("def to_h"), "to_h must no longer be inlined in the model"); + } - Assert.assertEquals(codegen.sanitizeModelName("JSON::Any"), "JSON::Any"); - // Disallows single colons - Assert.assertEquals(codegen.sanitizeModelName("JSON:Any"), "JSONAny"); + @Test + public void testValidDelegatesToListInvalidProperties() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + File model = files.stream().filter(f -> f.getPath().replace(File.separatorChar,'/').endsWith("/models/format_test.cr")) + .findFirst().orElseThrow(() -> new AssertionError("format_test.cr missing")); + String src = FileUtils.readFileToString(model, StandardCharsets.UTF_8); + assertTrue(src.contains("list_invalid_properties.empty?"), "valid? must delegate to list_invalid_properties"); + Assert.assertFalse(src.contains("nillable:"), "JSON::Field annotation noise must be gone"); + } + + @Test + public void testHeaderParamsAndParamsEncoder() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + File conn = files.stream().filter(f -> f.getName().equals("connection.cr")).findFirst().orElseThrow(() -> new AssertionError("connection.cr")); + String c = FileUtils.readFileToString(conn, StandardCharsets.UTF_8); + assertTrue(c.contains("header :"), "request must accept a header argument"); + assertTrue(c.contains("params_encoder: config.params_encoder"), "request must pass the params encoder"); + File pet = files.stream().filter(f -> f.getPath().replace(File.separatorChar,'/').endsWith("/api/pet.cr")).findFirst().orElseThrow(() -> new AssertionError("pet.cr")); + String p = FileUtils.readFileToString(pet, StandardCharsets.UTF_8); + assertTrue(p.contains("header: {") && p.contains("api_key"), "deletePet must wire its api_key header param"); + } + + @Test + public void testUnifiedValidatesMacro() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CrystalClientCodegen codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put("moduleName", "Petstore"); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + assertTrue(files.stream().anyMatch(f -> f.getName().equals("validation.cr")), + "validation.cr (shared validates macro) must be generated"); + Assert.assertFalse(files.stream().anyMatch(f -> f.getName().equals("enum_validation.cr")), + "old enum_validation.cr must be gone"); + File order = files.stream().filter(f -> f.getPath().replace(File.separatorChar,'/').endsWith("/models/order.cr")) + .findFirst().orElseThrow(() -> new AssertionError("order.cr missing")); + String src = FileUtils.readFileToString(order, StandardCharsets.UTF_8); + assertTrue(src.contains("include Petstore::Validation"), "enum model must include the Validation macro module"); + assertTrue(src.contains("validates("), "validated model must use the validates macro"); + Assert.assertFalse(src.contains("EnumAttributeValidator"), "old validator class must be gone"); + Assert.assertFalse(src.contains("enum_attribute("), "old enum_attribute macro must be gone"); + // list_invalid_properties must delegate to per-property _validation_error helpers + assertTrue(src.contains("_validation_error(@"), "validated model must call _validation_error in list_invalid_properties"); + } + + @Test + public void testApiNamespaceEmptyNestsDirectly() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/petstore.yaml"); + CrystalClientCodegen codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put("apiNamespace", ""); // nest api classes directly under moduleName + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + File pet = files.stream() + .filter(f -> f.getName().equals("pet.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")) + .findFirst().orElseThrow(() -> new AssertionError("api/pet.cr missing")); + String src = FileUtils.readFileToString(pet, StandardCharsets.UTF_8); + assertTrue(src.contains("class Pet"), "api class present"); + Assert.assertFalse(src.contains("module Api"), "with apiNamespace=\"\" there must be no Api sub-namespace"); + } + + @Test + public void testInheritanceAndReservedModelName() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec( + "src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + // allOf inheritance: child must not re-declare inherited properties and must call super. + File cat = files.stream().filter(f -> f.getName().equals("cat.cr")).findFirst() + .orElseThrow(() -> new AssertionError("cat.cr missing")); + String catSrc = FileUtils.readFileToString(cat, StandardCharsets.UTF_8); + assertTrue(catSrc.contains("class Cat < Animal"), "Cat must inherit Animal"); + assertTrue(catSrc.contains("property declawed"), "Cat keeps its own property"); + Assert.assertFalse(catSrc.contains("property class_name"), + "Cat must NOT re-declare the inherited class_name property"); + assertTrue(catSrc.contains("super("), "Cat constructor must call super for inherited props"); + + // discriminated base type emits use_json_discriminator/use_yaml_discriminator dispatching + // to the mapped subtypes. + File animal = files.stream().filter(f -> f.getName().equals("animal.cr")).findFirst() + .orElseThrow(() -> new AssertionError("animal.cr missing")); + String animalSrc = FileUtils.readFileToString(animal, StandardCharsets.UTF_8); + assertTrue(animalSrc.contains("use_json_discriminator \"className\""), + "Animal must dispatch on its discriminator for JSON"); + assertTrue(animalSrc.contains("use_yaml_discriminator \"className\""), + "Animal must dispatch on its discriminator for YAML"); + assertTrue(animalSrc.contains("=> Cat") && animalSrc.contains("=> Dog"), + "discriminator mapping must reference the mapped subtypes"); + + // api return/param types referencing a same-named model must be module-qualified, else + // inside `Api::Pet` the bare `Pet` resolves to the resource class, not the model. + File petApi = files.stream().filter(f -> f.getName().equals("pet.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")).findFirst() + .orElseThrow(() -> new AssertionError("api/pet.cr missing")); + String petApiSrc = FileUtils.readFileToString(petApi, StandardCharsets.UTF_8); + assertTrue(petApiSrc.contains("Array(OpenAPIClient::Pet)"), + "api types referencing a same-named model must be module-qualified (OpenAPIClient::Pet)"); + Assert.assertFalse(petApiSrc.contains("Response(Array(Pet))"), + "must not reference the bare model name (would resolve to the Api::Pet resource class)"); + + // a model named like a generated infrastructure class is renamed (Client -> ModelClient) + assertTrue(files.stream().anyMatch(f -> f.getName().equals("model_client.cr")), + "a 'Client' schema must be renamed to ModelClient to avoid clashing with the facade"); + Assert.assertFalse( + files.stream().anyMatch(f -> f.getPath().replace(File.separatorChar, '/').endsWith("/models/client.cr")), + "there must be no models/client.cr clashing with the generated Client facade"); + } + + @Test + public void testAdditionalPropertiesPreserved() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec( + "src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + // a model that allows additionalProperties captures+round-trips unknown keys via Unmapped + File nc = files.stream().filter(f -> f.getName().equals("nullable_class.cr")).findFirst() + .orElseThrow(() -> new AssertionError("nullable_class.cr missing")); + assertTrue(FileUtils.readFileToString(nc, StandardCharsets.UTF_8) + .contains("include JSON::Serializable::Unmapped"), + "a model allowing additionalProperties must include JSON::Serializable::Unmapped"); + // a plain model without additionalProperties must NOT include it + File tag = files.stream().filter(f -> f.getName().equals("tag.cr")).findFirst() + .orElseThrow(() -> new AssertionError("tag.cr missing")); + Assert.assertFalse(FileUtils.readFileToString(tag, StandardCharsets.UTF_8) + .contains("JSON::Serializable::Unmapped"), + "a model without additionalProperties must not include Unmapped"); + } + + @Test + public void testScalarDefaultValues() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/scalar-defaults.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + File w = files.stream().filter(f -> f.getName().equals("widget.cr")).findFirst() + .orElseThrow(() -> new AssertionError("widget.cr missing")); + String src = FileUtils.readFileToString(w, StandardCharsets.UTF_8); + assertTrue(src.contains("property size : Int32? = 10"), "integer default applied"); + assertTrue(src.contains("property label : String? = \"hi\""), "string default applied"); + assertTrue(src.contains("property active : Bool? = true"), "boolean default applied"); + // date/time defaults are intentionally NOT emitted (rendering not guaranteed valid Crystal) + assertTrue(src.contains("property created : Time?") && !src.contains("property created : Time? ="), + "date-time default must be skipped"); + } + + @Test + public void testCookieParams() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/cookie-params.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + File api = files.stream().filter(f -> f.getName().endsWith(".cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")).findFirst() + .orElseThrow(() -> new AssertionError("api file missing")); + String src = FileUtils.readFileToString(api, StandardCharsets.UTF_8); + // cookie params must appear in the signature and be sent via a combined Cookie header + assertTrue(src.contains("session : String? = nil") && src.contains("tracking : String? = nil"), + "cookie params must be declared in the signature"); + assertTrue(src.contains("\"Cookie\" =>") && src.contains("join(\"; \")"), + "cookie params must be sent as a combined Cookie header"); + } + + @Test + public void testOneOfDiscriminatorDispatch() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/oneof-discriminator.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + File pet = files.stream().filter(f -> f.getName().equals("pet.cr")).findFirst() + .orElseThrow(() -> new AssertionError("pet.cr missing")); + String src = FileUtils.readFileToString(pet, StandardCharsets.UTF_8); + // the discriminator must be read from the raw JSON field name (petType, not pet_type) + assertTrue(src.contains("disc_h[\"petType\"]"), "discriminator must use the JSON field name"); + assertTrue(src.contains("when \"cat\" then return new(Cat.from_json") && + src.contains("when \"dog\" then return new(Dog.from_json"), + "discriminator must dispatch to the mapped member types"); + } + + @Test + public void testNamedEnumAliasAndAnyOfUnion() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/qdrant.json"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + // named enum -> plain alias to its underlying primitive (consistent with inline enums) + File scalarType = files.stream().filter(f -> f.getName().equals("scalar_type.cr")).findFirst() + .orElseThrow(() -> new AssertionError("scalar_type.cr missing")); + String enumSrc = FileUtils.readFileToString(scalarType, StandardCharsets.UTF_8); + assertTrue(enumSrc.contains("alias ScalarType = String"), + "named enum must be an alias to its underlying type"); + Assert.assertFalse(enumSrc.contains("build_from_hash"), "legacy enum class machinery must be gone"); + + // anyOf -> a wrapper union that deserialises by trying each member + File orderValue = files.stream().filter(f -> f.getName().equals("order_value.cr")).findFirst() + .orElseThrow(() -> new AssertionError("order_value.cr missing")); + String anyOfSrc = FileUtils.readFileToString(orderValue, StandardCharsets.UTF_8); + assertTrue(anyOfSrc.contains("class OrderValue"), "anyOf model is a wrapper class"); + assertTrue(anyOfSrc.contains("Float64") && anyOfSrc.contains("Int64"), "anyOf members present"); + assertTrue(anyOfSrc.contains("def self.from_json"), "anyOf wrapper deserialises by trying each member"); + Assert.assertFalse(anyOfSrc.contains("const_get"), "broken const_get machinery must be gone"); + + // oneOf -> wrapper with its own try-each from_json. It must NOT `include JSON::Serializable` + // (that would generate a field-based new(pull) that can't build a union -> runtime crash). + File oneOf = files.stream().filter(f -> f.getName().equals("optimizers_status.cr")).findFirst() + .orElseThrow(() -> new AssertionError("optimizers_status.cr missing")); + String oneOfSrc = FileUtils.readFileToString(oneOf, StandardCharsets.UTF_8); + assertTrue(oneOfSrc.contains("def self.openapi_one_of"), "oneOf wrapper lists its members"); + assertTrue(oneOfSrc.contains("def self.from_json") && oneOfSrc.contains("def self.new(pull"), + "oneOf wrapper must define its own JSON deserialisation"); + Assert.assertFalse(oneOfSrc.contains("include JSON::Serializable"), + "oneOf wrapper must not include JSON::Serializable (generated new(pull) can't build a union)"); + } + + @Test + public void testHyphenatedApiKeySchemeQuotesSymbol() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/auth-hyphen.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + File config = files.stream().filter(f -> f.getName().equals("configuration.cr")).findFirst() + .orElseThrow(() -> new AssertionError("configuration.cr missing")); + String src = FileUtils.readFileToString(config, StandardCharsets.UTF_8); + // A scheme/param name with a hyphen must be a quoted symbol, else Crystal parses + // `:api-key` as `:api - key` and fails to compile. + assertTrue(src.contains("api_key_with_prefix(:\"api-key\")"), + "hyphenated api key scheme must use a quoted symbol"); + Assert.assertFalse(src.contains("api_key_with_prefix(:api-key)"), + "must not emit a bare symbol containing a hyphen (won't compile)"); + } + + @Test + public void testQueryArrayCollectionFormat() throws Exception { + final File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/crystal/collection-format.yaml"); + CodegenConfig codegen = new CrystalClientCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + List files = new DefaultGenerator().opts( + new ClientOptInput().openAPI(openAPI).config(codegen)).generate(); + + File api = files.stream().filter(f -> f.getName().equals("search.cr") && + f.getPath().replace(File.separatorChar, '/').contains("/api/")).findFirst() + .orElseThrow(() -> new AssertionError("api/search.cr missing")); + String src = FileUtils.readFileToString(api, StandardCharsets.UTF_8); + // non-multi array query params are joined with their separator; multi stays an array. + assertTrue(src.contains("\"csv_ids\" => csv_ids.try(&.map(&.to_s).join(\",\"))"), + "csv array param must be comma-joined"); + assertTrue(src.contains("\"ssv_ids\" => ssv_ids.try(&.map(&.to_s).join(\" \"))"), + "ssv array param must be space-joined"); + assertTrue(src.contains("\"pipe_ids\" => pipe_ids.try(&.map(&.to_s).join(\"|\"))"), + "pipe array param must be pipe-joined"); + assertTrue(src.contains("\"multi_ids\" => multi_ids,") || src.contains("\"multi_ids\" => multi_ids "), + "multi array param must stay an array (no join)"); } } diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/auth-hyphen.yaml b/modules/openapi-generator/src/test/resources/3_0/crystal/auth-hyphen.yaml new file mode 100644 index 000000000000..c85ebf469d2d --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/auth-hyphen.yaml @@ -0,0 +1,28 @@ +openapi: 3.0.1 +info: + title: Auth Hyphen Test + version: 1.0.0 +servers: + - url: https://example.com +paths: + /ping: + get: + tags: [health] + operationId: ping + security: + - api-key: [] + responses: + "200": + description: ok + content: + application/json: + schema: + type: string +components: + securitySchemes: + # Deliberately hyphenated scheme/param name: must produce a quoted Crystal symbol + # (:"api-key"), not a bare one (:api-key) which fails to compile. + api-key: + type: apiKey + name: api-key + in: header diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/collection-format.yaml b/modules/openapi-generator/src/test/resources/3_0/crystal/collection-format.yaml new file mode 100644 index 000000000000..dd8d0b5313b3 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/collection-format.yaml @@ -0,0 +1,45 @@ +openapi: 3.0.1 +info: + title: Collection Format Test + version: 1.0.0 +paths: + /search: + get: + tags: [search] + operationId: search + parameters: + - name: csv_ids + in: query + style: form + explode: false # -> csv: csv_ids=a,b,c + schema: + type: array + items: { type: string } + - name: ssv_ids + in: query + style: spaceDelimited + explode: false # -> ssv: ssv_ids=a%20b%20c + schema: + type: array + items: { type: string } + - name: pipe_ids + in: query + style: pipeDelimited + explode: false # -> pipes: pipe_ids=a|b|c + schema: + type: array + items: { type: string } + - name: multi_ids + in: query + style: form + explode: true # -> multi: multi_ids=a&multi_ids=b (left as array) + schema: + type: array + items: { type: string } + responses: + "200": + description: ok + content: + application/json: + schema: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/cookie-params.yaml b/modules/openapi-generator/src/test/resources/3_0/crystal/cookie-params.yaml new file mode 100644 index 000000000000..17a2d72113ce --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/cookie-params.yaml @@ -0,0 +1,11 @@ +openapi: 3.0.1 +info: {title: Cookie Test, version: 1.0.0} +paths: + /thing: + get: + operationId: getThing + tags: [things] + parameters: + - {name: session, in: cookie, schema: {type: string}} + - {name: tracking, in: cookie, schema: {type: string}} + responses: {"200": {description: ok, content: {application/json: {schema: {type: string}}}}} diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/namespacing.yaml b/modules/openapi-generator/src/test/resources/3_0/crystal/namespacing.yaml new file mode 100644 index 000000000000..22c5ed56d60e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/namespacing.yaml @@ -0,0 +1,11 @@ +openapi: 3.0.0 +info: { title: ns, version: 1.0.0 } +paths: + /store/orders: + get: { operationId: store_orders_list, responses: { '200': { description: ok } } } + /store/orders/{id}: + get: { operationId: store_orders_get, parameters: [ { name: id, in: path, required: true, schema: { type: integer } } ], responses: { '200': { description: ok } } } + /store/refresh: + post: { operationId: store_refresh, responses: { '200': { description: ok } } } + /ping: + get: { operationId: ping, responses: { '200': { description: ok } } } diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/oneof-discriminator.yaml b/modules/openapi-generator/src/test/resources/3_0/crystal/oneof-discriminator.yaml new file mode 100644 index 000000000000..bf3ac4f40c9c --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/oneof-discriminator.yaml @@ -0,0 +1,14 @@ +openapi: 3.0.1 +info: {title: Disc, version: 1.0.0} +paths: {/x: {get: {operationId: getX, tags: [x], responses: {"200": {description: ok}}}}} +components: + schemas: + Cat: {type: object, properties: {petType: {type: string}, name: {type: string}}} + Dog: {type: object, properties: {petType: {type: string}, name: {type: string}}} + Pet: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Dog' + discriminator: + propertyName: petType + mapping: {cat: '#/components/schemas/Cat', dog: '#/components/schemas/Dog'} diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/qdrant.json b/modules/openapi-generator/src/test/resources/3_0/crystal/qdrant.json new file mode 100644 index 000000000000..ada514b0de01 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/qdrant.json @@ -0,0 +1,13250 @@ +{ + "paths": { + "/collections/{collection_name}/shards": { + "put": { + "tags": [ + "collections", + "cluster" + ], + "summary": "Create shard key", + "operationId": "create_shard_key", + "requestBody": { + "description": "Shard key configuration", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateShardingKey" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to create shards for", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/shards/delete": { + "post": { + "tags": [ + "collections", + "cluster" + ], + "summary": "Delete shard key", + "operationId": "delete_shard_key", + "requestBody": { + "description": "Select shard key to delete", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DropShardingKey" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to create shards for", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/": { + "get": { + "summary": "Returns information about the running Qdrant instance", + "description": "Returns information about the running Qdrant instance like version and commit id", + "operationId": "root", + "tags": [ + "service" + ], + "responses": { + "200": { + "description": "Qdrant server version information", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionInfo" + } + } + } + }, + "4XX": { + "description": "error" + } + } + } + }, + "/telemetry": { + "get": { + "summary": "Collect telemetry data", + "description": "Collect telemetry data including app info, system info, collections info, cluster info, configs and statistics", + "operationId": "telemetry", + "tags": [ + "service" + ], + "parameters": [ + { + "name": "anonymize", + "in": "query", + "description": "If true, anonymize result", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/TelemetryData" + } + } + } + } + } + } + } + } + }, + "/metrics": { + "get": { + "summary": "Collect Prometheus metrics data", + "description": "Collect metrics data including app info, collections info, cluster info and statistics", + "operationId": "metrics", + "tags": [ + "service" + ], + "parameters": [ + { + "name": "anonymize", + "in": "query", + "description": "If true, anonymize result", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "200": { + "description": "Metrics data in Prometheus format", + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "# HELP app_info information about qdrant server\n# TYPE app_info gauge\napp_info{name=\"qdrant\",version=\"0.11.1\"} 1\n# HELP cluster_enabled is cluster support enabled\n# TYPE cluster_enabled gauge\ncluster_enabled 0\n# HELP collections_total number of collections\n# TYPE collections_total gauge\ncollections_total 1\n" + } + } + } + }, + "4XX": { + "description": "error" + } + } + } + }, + "/locks": { + "post": { + "summary": "Set lock options", + "description": "Set lock options. If write is locked, all write operations and collection creation are forbidden. Returns previous lock options", + "operationId": "post_locks", + "tags": [ + "service" + ], + "requestBody": { + "description": "Lock options and optional error message", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LocksOption" + } + } + } + }, + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/LocksOption" + } + } + } + } + } + } + } + }, + "get": { + "summary": "Get lock options", + "description": "Get lock options. If write is locked, all write operations and collection creation are forbidden", + "operationId": "get_locks", + "tags": [ + "service" + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/LocksOption" + } + } + } + } + } + } + } + } + }, + "/healthz": { + "get": { + "summary": "Kubernetes healthz endpoint", + "description": "An endpoint for health checking used in Kubernetes.", + "operationId": "healthz", + "tags": [ + "service" + ], + "responses": { + "200": { + "description": "Healthz response", + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "healthz check passed" + } + } + } + }, + "4XX": { + "description": "error" + } + } + } + }, + "/livez": { + "get": { + "summary": "Kubernetes livez endpoint", + "description": "An endpoint for health checking used in Kubernetes.", + "operationId": "livez", + "tags": [ + "service" + ], + "responses": { + "200": { + "description": "Healthz response", + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "healthz check passed" + } + } + } + }, + "4XX": { + "description": "error" + } + } + } + }, + "/readyz": { + "get": { + "summary": "Kubernetes readyz endpoint", + "description": "An endpoint for health checking used in Kubernetes.", + "operationId": "readyz", + "tags": [ + "service" + ], + "responses": { + "200": { + "description": "Healthz response", + "content": { + "text/plain": { + "schema": { + "type": "string", + "example": "healthz check passed" + } + } + } + }, + "4XX": { + "description": "error" + } + } + } + }, + "/issues": { + "get": { + "summary": "Get issues", + "description": "Get a report of performance issues and configuration suggestions", + "operationId": "get_issues", + "tags": [ + "beta" + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "4XX": { + "description": "error" + } + } + }, + "delete": { + "summary": "Clear issues", + "description": "Removes all issues reported so far", + "operationId": "clear_issues", + "tags": [ + "beta" + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + }, + "4XX": { + "description": "error" + } + } + } + }, + "/cluster": { + "get": { + "tags": [ + "cluster" + ], + "summary": "Get cluster status info", + "description": "Get information about the current state and composition of the cluster", + "operationId": "cluster_status", + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/ClusterStatus" + } + } + } + } + } + } + } + } + }, + "/cluster/recover": { + "post": { + "tags": [ + "cluster" + ], + "summary": "Tries to recover current peer Raft state.", + "operationId": "recover_current_peer", + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/cluster/peer/{peer_id}": { + "delete": { + "tags": [ + "cluster" + ], + "summary": "Remove peer from the cluster", + "description": "Tries to remove peer from the cluster. Will return an error if peer has shards on it.", + "operationId": "remove_peer", + "parameters": [ + { + "name": "peer_id", + "in": "path", + "description": "Id of the peer", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "force", + "in": "query", + "description": "If true - removes peer even if it has shards/replicas on it.", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/collections": { + "get": { + "tags": [ + "collections" + ], + "summary": "List collections", + "description": "Get list name of all existing collections", + "operationId": "get_collections", + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CollectionsResponse" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}": { + "get": { + "tags": [ + "collections" + ], + "summary": "Collection info", + "description": "Get detailed information about specified existing collection", + "operationId": "get_collection", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to retrieve", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CollectionInfo" + } + } + } + } + } + } + } + }, + "put": { + "tags": [ + "collections" + ], + "summary": "Create collection", + "description": "Create new collection with given parameters", + "operationId": "create_collection", + "requestBody": { + "description": "Parameters of a new collection", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCollection" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the new collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "patch": { + "tags": [ + "collections" + ], + "summary": "Update collection parameters", + "description": "Update parameters of the existing collection", + "operationId": "update_collection", + "requestBody": { + "description": "New parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateCollection" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to update", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "delete": { + "tags": [ + "collections" + ], + "summary": "Delete collection", + "description": "Drop collection and all associated data", + "operationId": "delete_collection", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to delete", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/collections/aliases": { + "post": { + "tags": [ + "collections" + ], + "summary": "Update aliases of the collections", + "operationId": "update_aliases", + "requestBody": { + "description": "Alias update operations", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChangeAliasesOperation" + } + } + } + }, + "parameters": [ + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/index": { + "put": { + "tags": [ + "collections" + ], + "summary": "Create index for field in collection", + "description": "Create index for field in collection", + "operationId": "create_field_index", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "requestBody": { + "description": "Field name", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateFieldIndex" + } + } + } + }, + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/exists": { + "get": { + "tags": [ + "collections" + ], + "summary": "Check the existence of a collection", + "description": "Returns \"true\" if the given collection name exists, and \"false\" otherwise", + "operationId": "collection_exists", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CollectionExistence" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/index/{field_name}": { + "delete": { + "tags": [ + "collections" + ], + "summary": "Delete index for field in collection", + "description": "Delete field index for collection", + "operationId": "delete_field_index", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "field_name", + "in": "path", + "description": "Name of the field where to delete the index", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/cluster": { + "get": { + "tags": [ + "collections", + "cluster" + ], + "summary": "Collection cluster info", + "description": "Get cluster information for a collection", + "operationId": "collection_cluster_info", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to retrieve the cluster info for", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CollectionClusterInfo" + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "collections", + "cluster" + ], + "summary": "Update collection cluster setup", + "operationId": "update_collection_cluster", + "requestBody": { + "description": "Collection cluster update operations", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClusterOperations" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection on which to to apply the cluster update operation", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "Wait for operation commit timeout in seconds. \nIf timeout is reached - request will return with service error.\n", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/aliases": { + "get": { + "tags": [ + "collections" + ], + "summary": "List aliases for collection", + "description": "Get list of all aliases for a collection", + "operationId": "get_collection_aliases", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CollectionsAliasesResponse" + } + } + } + } + } + } + } + } + }, + "/aliases": { + "get": { + "tags": [ + "collections" + ], + "summary": "List collections aliases", + "description": "Get list of all existing collections aliases", + "operationId": "get_collections_aliases", + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CollectionsAliasesResponse" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/snapshots/upload": { + "post": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Recover from an uploaded snapshot", + "description": "Recover local collection data from an uploaded snapshot. This will overwrite any data, stored on this node, for the collection. If collection does not exist - it will be created.", + "operationId": "recover_from_uploaded_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "priority", + "in": "query", + "description": "Defines source of truth for snapshot recovery", + "required": false, + "schema": { + "$ref": "#/components/schemas/SnapshotPriority" + } + }, + { + "name": "checksum", + "in": "query", + "description": "Optional SHA256 checksum to verify snapshot integrity before recovery.", + "required": false, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Snapshot to recover from", + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "snapshot": { + "type": "string", + "format": "binary" + } + } + } + } + } + }, + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/snapshots/recover": { + "put": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Recover from a snapshot", + "description": "Recover local collection data from a snapshot. This will overwrite any data, stored on this node, for the collection. If collection does not exist - it will be created.", + "operationId": "recover_from_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "description": "Snapshot to recover from", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SnapshotRecover" + } + } + } + }, + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/snapshots": { + "get": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "List collection snapshots", + "description": "Get list of snapshots for a collection", + "operationId": "list_snapshots", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SnapshotDescription" + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Create collection snapshot", + "description": "Create new snapshot for a collection", + "operationId": "create_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection for which to create a snapshot", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/SnapshotDescription" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/snapshots/{snapshot_name}": { + "delete": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Delete collection snapshot", + "description": "Delete snapshot for a collection", + "operationId": "delete_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection for which to delete a snapshot", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "snapshot_name", + "in": "path", + "description": "Name of the snapshot to delete", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + }, + "get": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Download collection snapshot", + "description": "Download specified snapshot from a collection as a file", + "operationId": "get_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "snapshot_name", + "in": "path", + "description": "Name of the snapshot to download", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "Snapshot file", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "/snapshots": { + "get": { + "tags": [ + "snapshots" + ], + "summary": "List of storage snapshots", + "description": "Get list of snapshots of the whole storage", + "operationId": "list_full_snapshots", + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SnapshotDescription" + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "snapshots" + ], + "summary": "Create storage snapshot", + "description": "Create new snapshot of the whole storage", + "operationId": "create_full_snapshot", + "parameters": [ + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/SnapshotDescription" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/snapshots/{snapshot_name}": { + "delete": { + "tags": [ + "snapshots" + ], + "summary": "Delete storage snapshot", + "description": "Delete snapshot of the whole storage", + "operationId": "delete_full_snapshot", + "parameters": [ + { + "name": "snapshot_name", + "in": "path", + "description": "Name of the full snapshot to delete", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + }, + "get": { + "tags": [ + "snapshots" + ], + "summary": "Download storage snapshot", + "description": "Download specified snapshot of the whole storage as a file", + "operationId": "get_full_snapshot", + "parameters": [ + { + "name": "snapshot_name", + "in": "path", + "description": "Name of the snapshot to download", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "Snapshot file", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "/collections/{collection_name}/shards/{shard_id}/snapshots/upload": { + "post": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Recover shard from an uploaded snapshot", + "description": "Recover shard of a local collection from an uploaded snapshot. This will overwrite any data, stored on this node, for the collection shard.", + "operationId": "recover_shard_from_uploaded_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shard_id", + "in": "path", + "description": "Id of the shard to recover", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "priority", + "in": "query", + "description": "Defines source of truth for snapshot recovery", + "required": false, + "schema": { + "$ref": "#/components/schemas/SnapshotPriority" + } + }, + { + "name": "checksum", + "in": "query", + "description": "Optional SHA256 checksum to verify snapshot integrity before recovery.", + "required": false, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "description": "Snapshot to recover from", + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "snapshot": { + "type": "string", + "format": "binary" + } + } + } + } + } + }, + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/shards/{shard_id}/snapshots/recover": { + "put": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Recover from a snapshot", + "description": "Recover shard of a local collection data from a snapshot. This will overwrite any data, stored in this shard, for the collection.", + "operationId": "recover_shard_from_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shard_id", + "in": "path", + "description": "Id of the shard to recover", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "requestBody": { + "description": "Snapshot to recover from", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ShardSnapshotRecover" + } + } + } + }, + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/shards/{shard_id}/snapshots": { + "get": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "List shards snapshots for a collection", + "description": "Get list of snapshots for a shard of a collection", + "operationId": "list_shard_snapshots", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shard_id", + "in": "path", + "description": "Id of the shard", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SnapshotDescription" + } + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Create shard snapshot", + "description": "Create new snapshot of a shard for a collection", + "operationId": "create_shard_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection for which to create a snapshot", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shard_id", + "in": "path", + "description": "Id of the shard", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/SnapshotDescription" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}": { + "delete": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Delete shard snapshot", + "description": "Delete snapshot of a shard for a collection", + "operationId": "delete_shard_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection for which to delete a snapshot", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shard_id", + "in": "path", + "description": "Id of the shard", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "snapshot_name", + "in": "path", + "description": "Name of the snapshot to delete", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen. If false - let changes happen in background. Default is true.", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "boolean" + } + } + } + } + } + }, + "202": { + "description": "operation is accepted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "string" + } + } + } + } + } + } + } + }, + "get": { + "tags": [ + "snapshots", + "collections" + ], + "summary": "Download collection snapshot", + "description": "Download specified snapshot of a shard from a collection as a file", + "operationId": "get_shard_snapshot", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "shard_id", + "in": "path", + "description": "Id of the shard", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "name": "snapshot_name", + "in": "path", + "description": "Name of the snapshot to download", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "Snapshot file", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/{id}": { + "get": { + "tags": [ + "points" + ], + "summary": "Get point", + "description": "Retrieve full information of single point by id", + "operationId": "get_point", + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to retrieve from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "id", + "in": "path", + "description": "Id of the point", + "required": true, + "schema": { + "$ref": "#/components/schemas/ExtendedPointId" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/Record" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points": { + "post": { + "tags": [ + "points" + ], + "summary": "Get points", + "description": "Retrieve multiple points by specified IDs", + "operationId": "get_points", + "requestBody": { + "description": "List of points to retrieve", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PointRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to retrieve from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Record" + } + } + } + } + } + } + } + } + }, + "put": { + "tags": [ + "points" + ], + "summary": "Upsert points", + "description": "Perform insert + updates on points. If point with given ID already exists - it will be overwritten.", + "operationId": "upsert_points", + "requestBody": { + "description": "Operation to perform on points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PointInsertOperations" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to update from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/delete": { + "post": { + "tags": [ + "points" + ], + "summary": "Delete points", + "description": "Delete points", + "operationId": "delete_points", + "requestBody": { + "description": "Operation to perform on points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PointsSelector" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to delete from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/vectors": { + "put": { + "tags": [ + "points" + ], + "summary": "Update vectors", + "description": "Update specified named vectors on points, keep unspecified vectors intact.", + "operationId": "update_vectors", + "requestBody": { + "description": "Update named vectors on points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateVectors" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to update from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/vectors/delete": { + "post": { + "tags": [ + "points" + ], + "summary": "Delete vectors", + "description": "Delete named vectors from the given points.", + "operationId": "delete_vectors", + "requestBody": { + "description": "Delete named vectors from points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteVectors" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to delete from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/payload": { + "post": { + "tags": [ + "points" + ], + "summary": "Set payload", + "description": "Set payload values for points", + "operationId": "set_payload", + "requestBody": { + "description": "Set payload on points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetPayload" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to set from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + }, + "put": { + "tags": [ + "points" + ], + "summary": "Overwrite payload", + "description": "Replace full payload of points with new one", + "operationId": "overwrite_payload", + "requestBody": { + "description": "Payload and points selector", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetPayload" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to set from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/payload/delete": { + "post": { + "tags": [ + "points" + ], + "summary": "Delete payload", + "description": "Delete specified key payload for points", + "operationId": "delete_payload", + "requestBody": { + "description": "delete payload on points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeletePayload" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to delete from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/payload/clear": { + "post": { + "tags": [ + "points" + ], + "summary": "Clear payload", + "description": "Remove all payload for specified points", + "operationId": "clear_payload", + "requestBody": { + "description": "clear payload on points", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PointsSelector" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to clear payload from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/batch": { + "post": { + "tags": [ + "points" + ], + "summary": "Batch update points", + "description": "Apply a series of update operations for points, vectors and payloads", + "operationId": "batch_update", + "requestBody": { + "description": "update operations", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateOperations" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to apply operations on", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "wait", + "in": "query", + "description": "If true, wait for changes to actually happen", + "required": false, + "schema": { + "type": "boolean" + } + }, + { + "name": "ordering", + "in": "query", + "description": "define ordering guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/WriteOrdering" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpdateResult" + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/scroll": { + "post": { + "tags": [ + "points" + ], + "summary": "Scroll points", + "description": "Scroll request - paginate over all points which matches given filtering condition", + "operationId": "scroll_points", + "requestBody": { + "description": "Pagination and filter parameters", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ScrollRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to retrieve from", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/ScrollResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/search": { + "post": { + "tags": [ + "points" + ], + "summary": "Search points", + "description": "Retrieve closest points based on vector similarity and given filtering conditions", + "operationId": "search_points", + "requestBody": { + "description": "Search request with optional filtering", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/search/batch": { + "post": { + "tags": [ + "points" + ], + "summary": "Search batch points", + "description": "Retrieve by batch the closest points based on vector similarity and given filtering conditions", + "operationId": "search_batch_points", + "requestBody": { + "description": "Search batch request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchRequestBatch" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/search/groups": { + "post": { + "tags": [ + "points" + ], + "summary": "Search point groups", + "description": "Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field", + "operationId": "search_point_groups", + "requestBody": { + "description": "Search request with optional filtering, grouped by a given payload field", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchGroupsRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/GroupsResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/recommend": { + "post": { + "tags": [ + "points" + ], + "summary": "Recommend points", + "description": "Look for the points which are closer to stored positive examples and at the same time further to negative examples.", + "operationId": "recommend_points", + "requestBody": { + "description": "Request points based on positive and negative examples.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecommendRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/recommend/batch": { + "post": { + "tags": [ + "points" + ], + "summary": "Recommend batch points", + "description": "Look for the points which are closer to stored positive examples and at the same time further to negative examples.", + "operationId": "recommend_batch_points", + "requestBody": { + "description": "Request points based on positive and negative examples.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecommendRequestBatch" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/recommend/groups": { + "post": { + "tags": [ + "points" + ], + "summary": "Recommend point groups", + "description": "Look for the points which are closer to stored positive examples and at the same time further to negative examples, grouped by a given payload field.", + "operationId": "recommend_point_groups", + "requestBody": { + "description": "Request points based on positive and negative examples, grouped by a payload field.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecommendGroupsRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/GroupsResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/discover": { + "post": { + "tags": [ + "points" + ], + "summary": "Discover points", + "description": "Use context and a target to find the most similar points to the target, constrained by the context.\nWhen using only the context (without a target), a special search - called context search - is performed where pairs of points are used to generate a loss that guides the search towards the zone where most positive examples overlap. This means that the score minimizes the scenario of finding a point closer to a negative than to a positive part of a pair.\nSince the score of a context relates to loss, the maximum score a point can get is 0.0, and it becomes normal that many points can have a score of 0.0.\nWhen using target (with or without context), the score behaves a little different: The integer part of the score represents the rank with respect to the context, while the decimal part of the score relates to the distance to the target. The context part of the score for each pair is calculated +1 if the point is closer to a positive than to a negative part of a pair, and -1 otherwise.\n", + "operationId": "discover_points", + "requestBody": { + "description": "Request points based on {positive, negative} pairs of examples, and/or a target", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DiscoverRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/discover/batch": { + "post": { + "tags": [ + "points" + ], + "summary": "Discover batch points", + "description": "Look for points based on target and/or positive and negative example pairs, in batch.", + "operationId": "discover_batch_points", + "requestBody": { + "description": "Batch request points based on { positive, negative } pairs of examples, and/or a target.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DiscoverRequestBatch" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/count": { + "post": { + "tags": [ + "points" + ], + "summary": "Count points", + "description": "Count points which matches given filtering condition", + "operationId": "count_points", + "requestBody": { + "description": "Request counts of points which matches given filtering condition", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CountRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to count in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/CountResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/facet": { + "post": { + "tags": [ + "points" + ], + "summary": "Facet a payload key with a given filter.", + "description": "Count points that satisfy the given filter for each unique value of a payload key.", + "operationId": "facet", + "requestBody": { + "description": "Request counts of points for each unique value of a payload key", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FacetRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to facet in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/FacetResponse" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/query": { + "post": { + "tags": [ + "points" + ], + "summary": "Query points", + "description": "Universally query points. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries.", + "operationId": "query_points", + "requestBody": { + "description": "Describes the query to make to the collection", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/QueryResponse" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/query/batch": { + "post": { + "tags": [ + "points" + ], + "summary": "Query points in batch", + "description": "Universally query points in batch. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries.", + "operationId": "query_batch_points", + "requestBody": { + "description": "Describes the queries to make to the collection", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryRequestBatch" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/QueryResponse" + } + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/query/groups": { + "post": { + "tags": [ + "points" + ], + "summary": "Query points, grouped by a given payload field", + "description": "Universally query points, grouped by a given payload field", + "operationId": "query_points_groups", + "requestBody": { + "description": "Describes the query to make to the collection", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryGroupsRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/GroupsResult" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/search/matrix/pairs": { + "post": { + "tags": [ + "points" + ], + "summary": "Search points matrix distance pairs", + "description": "Compute distance matrix for sampled points with a pair based output format", + "operationId": "search_matrix_pairs", + "requestBody": { + "description": "Search matrix request with optional filtering", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchMatrixRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/SearchMatrixPairsResponse" + } + } + } + } + } + } + } + } + }, + "/collections/{collection_name}/points/search/matrix/offsets": { + "post": { + "tags": [ + "points" + ], + "summary": "Search points matrix distance offsets", + "description": "Compute distance matrix for sampled points with an offset based output format", + "operationId": "search_matrix_offsets", + "requestBody": { + "description": "Search matrix request with optional filtering", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchMatrixRequest" + } + } + } + }, + "parameters": [ + { + "name": "collection_name", + "in": "path", + "description": "Name of the collection to search in", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "consistency", + "in": "query", + "description": "Define read consistency guarantees for the operation", + "required": false, + "schema": { + "$ref": "#/components/schemas/ReadConsistency" + } + }, + { + "name": "timeout", + "in": "query", + "description": "If set, overrides global timeout for this request. Unit is seconds.", + "required": false, + "schema": { + "type": "integer", + "minimum": 1 + } + } + ], + "responses": { + "default": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "4XX": { + "description": "error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request", + "example": 0.002 + }, + "status": { + "type": "string", + "example": "ok" + }, + "result": { + "$ref": "#/components/schemas/SearchMatrixOffsetsResponse" + } + } + } + } + } + } + } + } + } + }, + "openapi": "3.0.1", + "security": [ + { + "api-key": [] + }, + { + "bearerAuth": [] + }, + {} + ], + "info": { + "title": "Qdrant API", + "description": "API description for Qdrant vector search engine.\n\nThis document describes CRUD and search operations on collections of points (vectors with payload).\n\nQdrant supports any combinations of `should`, `min_should`, `must` and `must_not` conditions, which makes it possible to use in applications when object could not be described solely by vector. It could be location features, availability flags, and other custom properties businesses should take into account.\n## Examples\nThis examples cover the most basic use-cases - collection creation and basic vector search.\n### Create collection\nFirst - let's create a collection with dot-production metric.\n```\ncurl -X PUT 'http://localhost:6333/collections/test_collection' \\\n -H 'Content-Type: application/json' \\\n --data-raw '{\n \"vectors\": {\n \"size\": 4,\n \"distance\": \"Dot\"\n }\n }'\n\n```\nExpected response:\n```\n{\n \"result\": true,\n \"status\": \"ok\",\n \"time\": 0.031095451\n}\n```\nWe can ensure that collection was created:\n```\ncurl 'http://localhost:6333/collections/test_collection'\n```\nExpected response:\n```\n{\n \"result\": {\n \"status\": \"green\",\n \"vectors_count\": 0,\n \"segments_count\": 5,\n \"disk_data_size\": 0,\n \"ram_data_size\": 0,\n \"config\": {\n \"params\": {\n \"vectors\": {\n \"size\": 4,\n \"distance\": \"Dot\"\n }\n },\n \"hnsw_config\": {\n \"m\": 16,\n \"ef_construct\": 100,\n \"full_scan_threshold\": 10000\n },\n \"optimizer_config\": {\n \"deleted_threshold\": 0.2,\n \"vacuum_min_vector_number\": 1000,\n \"default_segment_number\": 2,\n \"max_segment_size\": null,\n \"memmap_threshold\": null,\n \"indexing_threshold\": 20000,\n \"flush_interval_sec\": 5,\n \"max_optimization_threads\": null\n },\n \"wal_config\": {\n \"wal_capacity_mb\": 32,\n \"wal_segments_ahead\": 0\n }\n }\n },\n \"status\": \"ok\",\n \"time\": 2.1199e-05\n}\n```\n\n### Add points\nLet's now add vectors with some payload:\n```\ncurl -L -X PUT 'http://localhost:6333/collections/test_collection/points?wait=true' \\ -H 'Content-Type: application/json' \\ --data-raw '{\n \"points\": [\n {\"id\": 1, \"vector\": [0.05, 0.61, 0.76, 0.74], \"payload\": {\"city\": \"Berlin\"}},\n {\"id\": 2, \"vector\": [0.19, 0.81, 0.75, 0.11], \"payload\": {\"city\": [\"Berlin\", \"London\"] }},\n {\"id\": 3, \"vector\": [0.36, 0.55, 0.47, 0.94], \"payload\": {\"city\": [\"Berlin\", \"Moscow\"] }},\n {\"id\": 4, \"vector\": [0.18, 0.01, 0.85, 0.80], \"payload\": {\"city\": [\"London\", \"Moscow\"] }},\n {\"id\": 5, \"vector\": [0.24, 0.18, 0.22, 0.44], \"payload\": {\"count\": [0]}},\n {\"id\": 6, \"vector\": [0.35, 0.08, 0.11, 0.44]}\n ]\n}'\n```\nExpected response:\n```\n{\n \"result\": {\n \"operation_id\": 0,\n \"status\": \"completed\"\n },\n \"status\": \"ok\",\n \"time\": 0.000206061\n}\n```\n### Search with filtering\nLet's start with a basic request:\n```\ncurl -L -X POST 'http://localhost:6333/collections/test_collection/points/search' \\ -H 'Content-Type: application/json' \\ --data-raw '{\n \"vector\": [0.2,0.1,0.9,0.7],\n \"top\": 3\n}'\n```\nExpected response:\n```\n{\n \"result\": [\n { \"id\": 4, \"score\": 1.362, \"payload\": null, \"version\": 0 },\n { \"id\": 1, \"score\": 1.273, \"payload\": null, \"version\": 0 },\n { \"id\": 3, \"score\": 1.208, \"payload\": null, \"version\": 0 }\n ],\n \"status\": \"ok\",\n \"time\": 0.000055785\n}\n```\nBut result is different if we add a filter:\n```\ncurl -L -X POST 'http://localhost:6333/collections/test_collection/points/search' \\ -H 'Content-Type: application/json' \\ --data-raw '{\n \"filter\": {\n \"should\": [\n {\n \"key\": \"city\",\n \"match\": {\n \"value\": \"London\"\n }\n }\n ]\n },\n \"vector\": [0.2, 0.1, 0.9, 0.7],\n \"top\": 3\n}'\n```\nExpected response:\n```\n{\n \"result\": [\n { \"id\": 4, \"score\": 1.362, \"payload\": null, \"version\": 0 },\n { \"id\": 2, \"score\": 0.871, \"payload\": null, \"version\": 0 }\n ],\n \"status\": \"ok\",\n \"time\": 0.000093972\n}\n```\n", + "contact": { + "email": "andrey@vasnetsov.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "master" + }, + "externalDocs": { + "description": "Find out more about Qdrant applications and demo", + "url": "https://qdrant.tech/documentation/" + }, + "servers": [ + { + "url": "{protocol}://{hostname}:{port}", + "variables": { + "protocol": { + "enum": [ + "http", + "https" + ], + "default": "http" + }, + "hostname": { + "default": "localhost" + }, + "port": { + "default": "6333" + } + } + } + ], + "tags": [ + { + "name": "collections", + "description": "Searchable collections of points." + }, + { + "name": "points", + "description": "Float-point vectors with payload." + }, + { + "name": "cluster", + "description": "Service distributed setup." + }, + { + "name": "snapshots", + "description": "Storage and collections snapshots." + }, + { + "name": "service", + "description": "Qdrant service utilities." + }, + { + "name": "beta", + "description": "Beta features, do not depend on these yet." + } + ], + "components": { + "securitySchemes": { + "api-key": { + "type": "apiKey", + "in": "header", + "name": "api-key", + "description": "Authorization key, either read-write or read-only" + }, + "bearerAuth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "ErrorResponse": { + "type": "object", + "properties": { + "time": { + "type": "number", + "format": "float", + "description": "Time spent to process this request" + }, + "status": { + "type": "object", + "properties": { + "error": { + "type": "string", + "description": "Description of the occurred error." + } + } + }, + "result": { + "type": "object", + "nullable": true + } + } + }, + "CollectionsResponse": { + "type": "object", + "required": [ + "collections" + ], + "properties": { + "collections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CollectionDescription" + } + } + }, + "example": { + "collections": [ + { + "name": "arivx-title" + }, + { + "name": "arivx-abstract" + }, + { + "name": "medium-title" + }, + { + "name": "medium-text" + } + ] + } + }, + "CollectionDescription": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + } + }, + "CollectionInfo": { + "description": "Current statistics and configuration of the collection", + "type": "object", + "required": [ + "config", + "optimizer_status", + "payload_schema", + "segments_count", + "status" + ], + "properties": { + "status": { + "$ref": "#/components/schemas/CollectionStatus" + }, + "optimizer_status": { + "$ref": "#/components/schemas/OptimizersStatus" + }, + "vectors_count": { + "description": "DEPRECATED: Approximate number of vectors in collection. All vectors in collection are available for querying. Calculated as `points_count x vectors_per_point`. Where `vectors_per_point` is a number of named vectors in schema.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "indexed_vectors_count": { + "description": "Approximate number of indexed vectors in the collection. Indexed vectors in large segments are faster to query, as it is stored in a specialized vector index.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "points_count": { + "description": "Approximate number of points (vectors + payloads) in collection. Each point could be accessed by unique id.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "segments_count": { + "description": "Number of segments in collection. Each segment has independent vector as payload indexes", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "config": { + "$ref": "#/components/schemas/CollectionConfig" + }, + "payload_schema": { + "description": "Types of stored payload", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/PayloadIndexInfo" + } + } + } + }, + "CollectionStatus": { + "description": "Current state of the collection. `Green` - all good. `Yellow` - optimization is running, 'Grey' - optimizations are possible but not triggered, `Red` - some operations failed and was not recovered", + "type": "string", + "enum": [ + "green", + "yellow", + "grey", + "red" + ] + }, + "OptimizersStatus": { + "description": "Current state of the collection", + "oneOf": [ + { + "description": "Optimizers are reporting as expected", + "type": "string", + "enum": [ + "ok" + ] + }, + { + "description": "Something wrong happened with optimizers", + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "CollectionConfig": { + "type": "object", + "required": [ + "hnsw_config", + "optimizer_config", + "params", + "wal_config" + ], + "properties": { + "params": { + "$ref": "#/components/schemas/CollectionParams" + }, + "hnsw_config": { + "$ref": "#/components/schemas/HnswConfig" + }, + "optimizer_config": { + "$ref": "#/components/schemas/OptimizersConfig" + }, + "wal_config": { + "$ref": "#/components/schemas/WalConfig" + }, + "quantization_config": { + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationConfig" + }, + { + "nullable": true + } + ] + } + } + }, + "CollectionParams": { + "type": "object", + "properties": { + "vectors": { + "$ref": "#/components/schemas/VectorsConfig" + }, + "shard_number": { + "description": "Number of shards the collection has", + "default": 1, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "sharding_method": { + "description": "Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardingMethod" + }, + { + "nullable": true + } + ] + }, + "replication_factor": { + "description": "Number of replicas for each shard", + "default": 1, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "write_consistency_factor": { + "description": "Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will make the collection more resilient to inconsistencies, but will also make it fail if not enough replicas are available. Does not have any performance impact.", + "default": 1, + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "read_fan_out_factor": { + "description": "Defines how many additional replicas should be processing read request at the same time. Default value is Auto, which means that fan-out will be determined automatically based on the busyness of the local replica. Having more than 0 might be useful to smooth latency spikes of individual nodes.", + "type": "integer", + "format": "uint32", + "minimum": 0, + "nullable": true + }, + "on_disk_payload": { + "description": "If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM.", + "default": false, + "type": "boolean" + }, + "sparse_vectors": { + "description": "Configuration of the sparse vector storage", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/SparseVectorParams" + }, + "nullable": true + } + } + }, + "VectorsConfig": { + "description": "Vector params separator for single and multiple vector modes Single mode:\n\n{ \"size\": 128, \"distance\": \"Cosine\" }\n\nor multiple mode:\n\n{ \"default\": { \"size\": 128, \"distance\": \"Cosine\" } }", + "anyOf": [ + { + "$ref": "#/components/schemas/VectorParams" + }, + { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/VectorParams" + } + } + ] + }, + "VectorParams": { + "description": "Params of single vector data storage", + "type": "object", + "required": [ + "distance", + "size" + ], + "properties": { + "size": { + "description": "Size of a vectors used", + "type": "integer", + "format": "uint64", + "minimum": 1 + }, + "distance": { + "$ref": "#/components/schemas/Distance" + }, + "hnsw_config": { + "description": "Custom params for HNSW index. If none - values from collection configuration are used.", + "anyOf": [ + { + "$ref": "#/components/schemas/HnswConfigDiff" + }, + { + "nullable": true + } + ] + }, + "quantization_config": { + "description": "Custom params for quantization. If none - values from collection configuration are used.", + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationConfig" + }, + { + "nullable": true + } + ] + }, + "on_disk": { + "description": "If true, vectors are served from disk, improving RAM usage at the cost of latency Default: false", + "type": "boolean", + "nullable": true + }, + "datatype": { + "description": "Defines which datatype should be used to represent vectors in the storage. Choosing different datatypes allows to optimize memory usage and performance vs accuracy.\n\n- For `float32` datatype - vectors are stored as single-precision floating point numbers, 4 bytes. - For `float16` datatype - vectors are stored as half-precision floating point numbers, 2 bytes. - For `uint8` datatype - vectors are stored as unsigned 8-bit integers, 1 byte. It expects vector elements to be in range `[0, 255]`.", + "anyOf": [ + { + "$ref": "#/components/schemas/Datatype" + }, + { + "nullable": true + } + ] + }, + "multivector_config": { + "anyOf": [ + { + "$ref": "#/components/schemas/MultiVectorConfig" + }, + { + "nullable": true + } + ] + } + } + }, + "Distance": { + "description": "Type of internal tags, build from payload Distance function types used to compare vectors", + "type": "string", + "enum": [ + "Cosine", + "Euclid", + "Dot", + "Manhattan" + ] + }, + "HnswConfigDiff": { + "type": "object", + "properties": { + "m": { + "description": "Number of edges per node in the index graph. Larger the value - more accurate the search, more space required.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "ef_construct": { + "description": "Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build the index.", + "type": "integer", + "format": "uint", + "minimum": 4, + "nullable": true + }, + "full_scan_threshold": { + "description": "Minimal size (in kilobytes) of vectors for additional payload-based indexing. If payload chunk is smaller than `full_scan_threshold_kb` additional indexing won't be used - in this case full-scan search should be preferred by query planner and additional indexing is not required. Note: 1Kb = 1 vector of size 256", + "type": "integer", + "format": "uint", + "minimum": 10, + "nullable": true + }, + "max_indexing_threads": { + "description": "Number of parallel threads used for background index building. If 0 - automatically select from 8 to 16. Best to keep between 8 and 16 to prevent likelihood of building broken/inefficient HNSW graphs. On small CPUs, less threads are used.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "on_disk": { + "description": "Store HNSW index on disk. If set to false, the index will be stored in RAM. Default: false", + "type": "boolean", + "nullable": true + }, + "payload_m": { + "description": "Custom M param for additional payload-aware HNSW links. If not set, default M will be used.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "QuantizationConfig": { + "anyOf": [ + { + "$ref": "#/components/schemas/ScalarQuantization" + }, + { + "$ref": "#/components/schemas/ProductQuantization" + }, + { + "$ref": "#/components/schemas/BinaryQuantization" + } + ] + }, + "ScalarQuantization": { + "type": "object", + "required": [ + "scalar" + ], + "properties": { + "scalar": { + "$ref": "#/components/schemas/ScalarQuantizationConfig" + } + } + }, + "ScalarQuantizationConfig": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/ScalarType" + }, + "quantile": { + "description": "Quantile for quantization. Expected value range in [0.5, 1.0]. If not set - use the whole range of values", + "type": "number", + "format": "float", + "maximum": 1, + "minimum": 0.5, + "nullable": true + }, + "always_ram": { + "description": "If true - quantized vectors always will be stored in RAM, ignoring the config of main storage", + "type": "boolean", + "nullable": true + } + } + }, + "ScalarType": { + "type": "string", + "enum": [ + "int8" + ] + }, + "ProductQuantization": { + "type": "object", + "required": [ + "product" + ], + "properties": { + "product": { + "$ref": "#/components/schemas/ProductQuantizationConfig" + } + } + }, + "ProductQuantizationConfig": { + "type": "object", + "required": [ + "compression" + ], + "properties": { + "compression": { + "$ref": "#/components/schemas/CompressionRatio" + }, + "always_ram": { + "type": "boolean", + "nullable": true + } + } + }, + "CompressionRatio": { + "type": "string", + "enum": [ + "x4", + "x8", + "x16", + "x32", + "x64" + ] + }, + "BinaryQuantization": { + "type": "object", + "required": [ + "binary" + ], + "properties": { + "binary": { + "$ref": "#/components/schemas/BinaryQuantizationConfig" + } + } + }, + "BinaryQuantizationConfig": { + "type": "object", + "properties": { + "always_ram": { + "type": "boolean", + "nullable": true + } + } + }, + "Datatype": { + "type": "string", + "enum": [ + "float32", + "uint8", + "float16" + ] + }, + "MultiVectorConfig": { + "type": "object", + "required": [ + "comparator" + ], + "properties": { + "comparator": { + "$ref": "#/components/schemas/MultiVectorComparator" + } + } + }, + "MultiVectorComparator": { + "type": "string", + "enum": [ + "max_sim" + ] + }, + "ShardingMethod": { + "type": "string", + "enum": [ + "auto", + "custom" + ] + }, + "SparseVectorParams": { + "description": "Params of single sparse vector data storage", + "type": "object", + "properties": { + "index": { + "description": "Custom params for index. If none - values from collection configuration are used.", + "anyOf": [ + { + "$ref": "#/components/schemas/SparseIndexParams" + }, + { + "nullable": true + } + ] + }, + "modifier": { + "description": "Configures addition value modifications for sparse vectors. Default: none", + "anyOf": [ + { + "$ref": "#/components/schemas/Modifier" + }, + { + "nullable": true + } + ] + } + } + }, + "SparseIndexParams": { + "description": "Configuration for sparse inverted index.", + "type": "object", + "properties": { + "full_scan_threshold": { + "description": "We prefer a full scan search upto (excluding) this number of vectors.\n\nNote: this is number of vectors, not KiloBytes.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "on_disk": { + "description": "Store index on disk. If set to false, the index will be stored in RAM. Default: false", + "type": "boolean", + "nullable": true + }, + "datatype": { + "description": "Defines which datatype should be used for the index. Choosing different datatypes allows to optimize memory usage and performance vs accuracy.\n\n- For `float32` datatype - vectors are stored as single-precision floating point numbers, 4 bytes. - For `float16` datatype - vectors are stored as half-precision floating point numbers, 2 bytes. - For `uint8` datatype - vectors are quantized to unsigned 8-bit integers, 1 byte. Quantization to fit byte range `[0, 255]` happens during indexing automatically, so the actual vector data does not need to conform to this range.", + "anyOf": [ + { + "$ref": "#/components/schemas/Datatype" + }, + { + "nullable": true + } + ] + } + } + }, + "Modifier": { + "description": "If used, include weight modification, which will be applied to sparse vectors at query time: None - no modification (default) Idf - inverse document frequency, based on statistics of the collection", + "type": "string", + "enum": [ + "none", + "idf" + ] + }, + "HnswConfig": { + "description": "Config of HNSW index", + "type": "object", + "required": [ + "ef_construct", + "full_scan_threshold", + "m" + ], + "properties": { + "m": { + "description": "Number of edges per node in the index graph. Larger the value - more accurate the search, more space required.", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "ef_construct": { + "description": "Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build index.", + "type": "integer", + "format": "uint", + "minimum": 4 + }, + "full_scan_threshold": { + "description": "Minimal size (in KiloBytes) of vectors for additional payload-based indexing. If payload chunk is smaller than `full_scan_threshold_kb` additional indexing won't be used - in this case full-scan search should be preferred by query planner and additional indexing is not required. Note: 1Kb = 1 vector of size 256", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "max_indexing_threads": { + "description": "Number of parallel threads used for background index building. If 0 - automatically select from 8 to 16. Best to keep between 8 and 16 to prevent likelihood of slow building or broken/inefficient HNSW graphs. On small CPUs, less threads are used.", + "default": 0, + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "on_disk": { + "description": "Store HNSW index on disk. If set to false, index will be stored in RAM. Default: false", + "type": "boolean", + "nullable": true + }, + "payload_m": { + "description": "Custom M param for hnsw graph built for payload index. If not set, default M will be used.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "OptimizersConfig": { + "type": "object", + "required": [ + "default_segment_number", + "deleted_threshold", + "flush_interval_sec", + "vacuum_min_vector_number" + ], + "properties": { + "deleted_threshold": { + "description": "The minimal fraction of deleted vectors in a segment, required to perform segment optimization", + "type": "number", + "format": "double", + "maximum": 1, + "minimum": 0 + }, + "vacuum_min_vector_number": { + "description": "The minimal number of vectors in a segment, required to perform segment optimization", + "type": "integer", + "format": "uint", + "minimum": 100 + }, + "default_segment_number": { + "description": "Target amount of segments optimizer will try to keep. Real amount of segments may vary depending on multiple parameters: - Amount of stored points - Current write RPS\n\nIt is recommended to select default number of segments as a factor of the number of search threads, so that each segment would be handled evenly by one of the threads. If `default_segment_number = 0`, will be automatically selected by the number of available CPUs.", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "max_segment_size": { + "description": "Do not create segments larger this size (in kilobytes). Large segments might require disproportionately long indexation times, therefore it makes sense to limit the size of segments.\n\nIf indexing speed is more important - make this parameter lower. If search speed is more important - make this parameter higher. Note: 1Kb = 1 vector of size 256 If not set, will be automatically selected considering the number of available CPUs.", + "default": null, + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "memmap_threshold": { + "description": "Maximum size (in kilobytes) of vectors to store in-memory per segment. Segments larger than this threshold will be stored as read-only memmaped file.\n\nMemmap storage is disabled by default, to enable it, set this threshold to a reasonable value.\n\nTo disable memmap storage, set this to `0`. Internally it will use the largest threshold possible.\n\nNote: 1Kb = 1 vector of size 256", + "default": null, + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "indexing_threshold": { + "description": "Maximum size (in kilobytes) of vectors allowed for plain index, exceeding this threshold will enable vector indexing\n\nDefault value is 20,000, based on .\n\nTo disable vector indexing, set to `0`.\n\nNote: 1kB = 1 vector of size 256.", + "default": null, + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "flush_interval_sec": { + "description": "Minimum interval between forced flushes.", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_optimization_threads": { + "description": "Max number of threads (jobs) for running optimizations per shard. Note: each optimization job will also use `max_indexing_threads` threads by itself for index building. If null - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled.", + "default": null, + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "WalConfig": { + "type": "object", + "required": [ + "wal_capacity_mb", + "wal_segments_ahead" + ], + "properties": { + "wal_capacity_mb": { + "description": "Size of a single WAL segment in MB", + "type": "integer", + "format": "uint", + "minimum": 1 + }, + "wal_segments_ahead": { + "description": "Number of WAL segments to create ahead of actually used ones", + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "PayloadIndexInfo": { + "description": "Display payload field type & index information", + "type": "object", + "required": [ + "data_type", + "points" + ], + "properties": { + "data_type": { + "$ref": "#/components/schemas/PayloadSchemaType" + }, + "params": { + "anyOf": [ + { + "$ref": "#/components/schemas/PayloadSchemaParams" + }, + { + "nullable": true + } + ] + }, + "points": { + "description": "Number of points indexed with this index", + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "PayloadSchemaType": { + "description": "All possible names of payload types", + "type": "string", + "enum": [ + "keyword", + "integer", + "float", + "geo", + "text", + "bool", + "datetime", + "uuid" + ] + }, + "PayloadSchemaParams": { + "description": "Payload type with parameters", + "anyOf": [ + { + "$ref": "#/components/schemas/KeywordIndexParams" + }, + { + "$ref": "#/components/schemas/IntegerIndexParams" + }, + { + "$ref": "#/components/schemas/FloatIndexParams" + }, + { + "$ref": "#/components/schemas/GeoIndexParams" + }, + { + "$ref": "#/components/schemas/TextIndexParams" + }, + { + "$ref": "#/components/schemas/BoolIndexParams" + }, + { + "$ref": "#/components/schemas/DatetimeIndexParams" + }, + { + "$ref": "#/components/schemas/UuidIndexParams" + } + ] + }, + "KeywordIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/KeywordIndexType" + }, + "is_tenant": { + "description": "If true - used for tenant optimization. Default: false.", + "type": "boolean", + "nullable": true + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "KeywordIndexType": { + "type": "string", + "enum": [ + "keyword" + ] + }, + "IntegerIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/IntegerIndexType" + }, + "lookup": { + "description": "If true - support direct lookups.", + "type": "boolean", + "nullable": true + }, + "range": { + "description": "If true - support ranges filters.", + "type": "boolean", + "nullable": true + }, + "is_principal": { + "description": "If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests.", + "type": "boolean", + "nullable": true + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "IntegerIndexType": { + "type": "string", + "enum": [ + "integer" + ] + }, + "FloatIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/FloatIndexType" + }, + "is_principal": { + "description": "If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests.", + "type": "boolean", + "nullable": true + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "FloatIndexType": { + "type": "string", + "enum": [ + "float" + ] + }, + "GeoIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/GeoIndexType" + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "GeoIndexType": { + "type": "string", + "enum": [ + "geo" + ] + }, + "TextIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/TextIndexType" + }, + "tokenizer": { + "$ref": "#/components/schemas/TokenizerType" + }, + "min_token_len": { + "description": "Minimum characters to be tokenized.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "max_token_len": { + "description": "Maximum characters to be tokenized.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "lowercase": { + "description": "If true, lowercase all tokens. Default: true.", + "type": "boolean", + "nullable": true + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "TextIndexType": { + "type": "string", + "enum": [ + "text" + ] + }, + "TokenizerType": { + "type": "string", + "enum": [ + "prefix", + "whitespace", + "word", + "multilingual" + ] + }, + "BoolIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/BoolIndexType" + } + } + }, + "BoolIndexType": { + "type": "string", + "enum": [ + "bool" + ] + }, + "DatetimeIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/DatetimeIndexType" + }, + "is_principal": { + "description": "If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests.", + "type": "boolean", + "nullable": true + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "DatetimeIndexType": { + "type": "string", + "enum": [ + "datetime" + ] + }, + "UuidIndexParams": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "$ref": "#/components/schemas/UuidIndexType" + }, + "is_tenant": { + "description": "If true - used for tenant optimization.", + "type": "boolean", + "nullable": true + }, + "on_disk": { + "description": "If true, store the index on disk. Default: false.", + "type": "boolean", + "nullable": true + } + } + }, + "UuidIndexType": { + "type": "string", + "enum": [ + "uuid" + ] + }, + "PointRequest": { + "type": "object", + "required": [ + "ids" + ], + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "ids": { + "description": "Look for points with ids", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + } + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is true.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "$ref": "#/components/schemas/WithVector" + } + } + }, + "ShardKeySelector": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKey" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShardKey" + } + } + ] + }, + "ShardKey": { + "anyOf": [ + { + "type": "string", + "example": "region_1" + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0, + "example": 12 + } + ] + }, + "ExtendedPointId": { + "description": "Type, used for specifying point ID in user interface", + "anyOf": [ + { + "type": "integer", + "format": "uint64", + "minimum": 0, + "example": 42 + }, + { + "type": "string", + "format": "uuid", + "example": "550e8400-e29b-41d4-a716-446655440000" + } + ] + }, + "WithPayloadInterface": { + "description": "Options for specifying which payload to include or not", + "anyOf": [ + { + "description": "If `true` - return all payload, If `false` - do not return payload", + "type": "boolean" + }, + { + "description": "Specify which fields to return", + "type": "array", + "items": { + "type": "string" + } + }, + { + "$ref": "#/components/schemas/PayloadSelector" + } + ] + }, + "PayloadSelector": { + "description": "Specifies how to treat payload selector", + "anyOf": [ + { + "$ref": "#/components/schemas/PayloadSelectorInclude" + }, + { + "$ref": "#/components/schemas/PayloadSelectorExclude" + } + ] + }, + "PayloadSelectorInclude": { + "type": "object", + "required": [ + "include" + ], + "properties": { + "include": { + "description": "Only include this payload keys", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "PayloadSelectorExclude": { + "type": "object", + "required": [ + "exclude" + ], + "properties": { + "exclude": { + "description": "Exclude this fields from returning payload", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "WithVector": { + "description": "Options for specifying which vector to include", + "anyOf": [ + { + "description": "If `true` - return all vector, If `false` - do not return vector", + "type": "boolean" + }, + { + "description": "Specify which vector to return", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "Record": { + "description": "Point data", + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "payload": { + "description": "Payload - values assigned to the point", + "anyOf": [ + { + "$ref": "#/components/schemas/Payload" + }, + { + "nullable": true + } + ] + }, + "vector": { + "description": "Vector of the point", + "anyOf": [ + { + "$ref": "#/components/schemas/VectorStruct" + }, + { + "nullable": true + } + ] + }, + "shard_key": { + "description": "Shard Key", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKey" + }, + { + "nullable": true + } + ] + }, + "order_value": { + "anyOf": [ + { + "$ref": "#/components/schemas/OrderValue" + }, + { + "nullable": true + } + ] + } + } + }, + "Payload": { + "type": "object", + "additionalProperties": true, + "example": { + "city": "London", + "color": "green" + } + }, + "VectorStruct": { + "description": "Full vector data per point separator with single and multiple vector modes", + "anyOf": [ + { + "type": "array", + "items": { + "type": "number", + "format": "float" + }, + "example": [ + 0.875, + 0.140625, + 0.897599995136261 + ] + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + "example": [ + [ + 0.875, + 0.140625, + 0.11020000278949738 + ], + [ + 0.7580000162124634, + 0.28126001358032227, + 0.9687100052833557 + ], + [ + 0.6209999918937683, + 0.42187801003456116, + 0.9375 + ] + ] + }, + { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Vector" + }, + "example": { + "image-embeddings": [ + 0.8730000257492065, + 0.140625, + 0.897599995136261 + ] + } + }, + { + "$ref": "#/components/schemas/Document" + } + ] + }, + "Vector": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + { + "$ref": "#/components/schemas/SparseVector" + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + }, + { + "$ref": "#/components/schemas/Document" + } + ] + }, + "SparseVector": { + "description": "Sparse vector structure", + "type": "object", + "required": [ + "indices", + "values" + ], + "properties": { + "indices": { + "description": "Indices must be unique", + "type": "array", + "items": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + }, + "values": { + "description": "Values and indices must be the same length", + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + } + }, + "Document": { + "description": "WARN: Work-in-progress, unimplemented\n\nText document for embedding. Requires inference infrastructure, unimplemented.", + "type": "object", + "required": [ + "text" + ], + "properties": { + "text": { + "description": "Text of the document This field will be used as input for the embedding model", + "type": "string" + }, + "model": { + "description": "Name of the model used to generate the vector List of available models depends on a provider", + "type": "string", + "nullable": true + } + } + }, + "OrderValue": { + "anyOf": [ + { + "type": "integer", + "format": "int64", + "example": 42 + }, + { + "type": "number", + "format": "double", + "example": 42.5 + } + ] + }, + "SearchRequest": { + "description": "Search request. Holds all conditions and parameters for the search of most similar points by vector similarity given the filtering restrictions.", + "type": "object", + "required": [ + "limit", + "vector" + ], + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "vector": { + "$ref": "#/components/schemas/NamedVectorStruct" + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Additional search params", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "limit": { + "description": "Max number of result to return", + "type": "integer", + "format": "uint", + "minimum": 1 + }, + "offset": { + "description": "Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "description": "Options for specifying which vectors to include into response. Default is false.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.", + "type": "number", + "format": "float", + "nullable": true + } + } + }, + "NamedVectorStruct": { + "description": "Vector data separator for named and unnamed modes Unnamed mode:\n\n{ \"vector\": [1.0, 2.0, 3.0] }\n\nor named mode:\n\n{ \"vector\": { \"vector\": [1.0, 2.0, 3.0], \"name\": \"image-embeddings\" } }", + "anyOf": [ + { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + { + "$ref": "#/components/schemas/NamedVector" + }, + { + "$ref": "#/components/schemas/NamedSparseVector" + } + ] + }, + "NamedVector": { + "description": "Dense vector data with name", + "type": "object", + "required": [ + "name", + "vector" + ], + "properties": { + "name": { + "description": "Name of vector data", + "type": "string" + }, + "vector": { + "description": "Vector data", + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + } + }, + "NamedSparseVector": { + "description": "Sparse vector data with name", + "type": "object", + "required": [ + "name", + "vector" + ], + "properties": { + "name": { + "description": "Name of vector data", + "type": "string" + }, + "vector": { + "$ref": "#/components/schemas/SparseVector" + } + } + }, + "Filter": { + "type": "object", + "properties": { + "should": { + "description": "At least one of those conditions should match", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/Condition" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Condition" + } + }, + { + "nullable": true + } + ] + }, + "min_should": { + "description": "At least minimum amount of given conditions should match", + "anyOf": [ + { + "$ref": "#/components/schemas/MinShould" + }, + { + "nullable": true + } + ] + }, + "must": { + "description": "All conditions must match", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/Condition" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Condition" + } + }, + { + "nullable": true + } + ] + }, + "must_not": { + "description": "All conditions must NOT match", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/Condition" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Condition" + } + }, + { + "nullable": true + } + ] + } + }, + "additionalProperties": false + }, + "Condition": { + "anyOf": [ + { + "$ref": "#/components/schemas/FieldCondition" + }, + { + "$ref": "#/components/schemas/IsEmptyCondition" + }, + { + "$ref": "#/components/schemas/IsNullCondition" + }, + { + "$ref": "#/components/schemas/HasIdCondition" + }, + { + "$ref": "#/components/schemas/NestedCondition" + }, + { + "$ref": "#/components/schemas/Filter" + } + ] + }, + "FieldCondition": { + "description": "All possible payload filtering conditions", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "description": "Payload key", + "type": "string" + }, + "match": { + "description": "Check if point has field with a given value", + "anyOf": [ + { + "$ref": "#/components/schemas/Match" + }, + { + "nullable": true + } + ] + }, + "range": { + "description": "Check if points value lies in a given range", + "anyOf": [ + { + "$ref": "#/components/schemas/RangeInterface" + }, + { + "nullable": true + } + ] + }, + "geo_bounding_box": { + "description": "Check if points geo location lies in a given area", + "anyOf": [ + { + "$ref": "#/components/schemas/GeoBoundingBox" + }, + { + "nullable": true + } + ] + }, + "geo_radius": { + "description": "Check if geo point is within a given radius", + "anyOf": [ + { + "$ref": "#/components/schemas/GeoRadius" + }, + { + "nullable": true + } + ] + }, + "geo_polygon": { + "description": "Check if geo point is within a given polygon", + "anyOf": [ + { + "$ref": "#/components/schemas/GeoPolygon" + }, + { + "nullable": true + } + ] + }, + "values_count": { + "description": "Check number of values of the field", + "anyOf": [ + { + "$ref": "#/components/schemas/ValuesCount" + }, + { + "nullable": true + } + ] + } + } + }, + "Match": { + "description": "Match filter request", + "anyOf": [ + { + "$ref": "#/components/schemas/MatchValue" + }, + { + "$ref": "#/components/schemas/MatchText" + }, + { + "$ref": "#/components/schemas/MatchAny" + }, + { + "$ref": "#/components/schemas/MatchExcept" + } + ] + }, + "MatchValue": { + "description": "Exact match of the given value", + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "$ref": "#/components/schemas/ValueVariants" + } + } + }, + "ValueVariants": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "int64" + }, + { + "type": "boolean" + } + ] + }, + "MatchText": { + "description": "Full-text match of the strings.", + "type": "object", + "required": [ + "text" + ], + "properties": { + "text": { + "type": "string" + } + } + }, + "MatchAny": { + "description": "Exact match on any of the given values", + "type": "object", + "required": [ + "any" + ], + "properties": { + "any": { + "$ref": "#/components/schemas/AnyVariants" + } + } + }, + "AnyVariants": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + }, + "uniqueItems": true + } + ] + }, + "MatchExcept": { + "description": "Should have at least one value not matching the any given values", + "type": "object", + "required": [ + "except" + ], + "properties": { + "except": { + "$ref": "#/components/schemas/AnyVariants" + } + } + }, + "RangeInterface": { + "anyOf": [ + { + "$ref": "#/components/schemas/Range" + }, + { + "$ref": "#/components/schemas/DatetimeRange" + } + ] + }, + "Range": { + "description": "Range filter request", + "type": "object", + "properties": { + "lt": { + "description": "point.key < range.lt", + "type": "number", + "format": "double", + "nullable": true + }, + "gt": { + "description": "point.key > range.gt", + "type": "number", + "format": "double", + "nullable": true + }, + "gte": { + "description": "point.key >= range.gte", + "type": "number", + "format": "double", + "nullable": true + }, + "lte": { + "description": "point.key <= range.lte", + "type": "number", + "format": "double", + "nullable": true + } + } + }, + "DatetimeRange": { + "description": "Range filter request", + "type": "object", + "properties": { + "lt": { + "description": "point.key < range.lt", + "type": "string", + "format": "date-time", + "nullable": true + }, + "gt": { + "description": "point.key > range.gt", + "type": "string", + "format": "date-time", + "nullable": true + }, + "gte": { + "description": "point.key >= range.gte", + "type": "string", + "format": "date-time", + "nullable": true + }, + "lte": { + "description": "point.key <= range.lte", + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "GeoBoundingBox": { + "description": "Geo filter request\n\nMatches coordinates inside the rectangle, described by coordinates of lop-left and bottom-right edges", + "type": "object", + "required": [ + "bottom_right", + "top_left" + ], + "properties": { + "top_left": { + "$ref": "#/components/schemas/GeoPoint" + }, + "bottom_right": { + "$ref": "#/components/schemas/GeoPoint" + } + } + }, + "GeoPoint": { + "description": "Geo point payload schema", + "type": "object", + "required": [ + "lat", + "lon" + ], + "properties": { + "lon": { + "type": "number", + "format": "double" + }, + "lat": { + "type": "number", + "format": "double" + } + } + }, + "GeoRadius": { + "description": "Geo filter request\n\nMatches coordinates inside the circle of `radius` and center with coordinates `center`", + "type": "object", + "required": [ + "center", + "radius" + ], + "properties": { + "center": { + "$ref": "#/components/schemas/GeoPoint" + }, + "radius": { + "description": "Radius of the area in meters", + "type": "number", + "format": "double" + } + } + }, + "GeoPolygon": { + "description": "Geo filter request\n\nMatches coordinates inside the polygon, defined by `exterior` and `interiors`", + "type": "object", + "required": [ + "exterior" + ], + "properties": { + "exterior": { + "$ref": "#/components/schemas/GeoLineString" + }, + "interiors": { + "description": "Interior lines (if present) bound holes within the surface each GeoLineString must consist of a minimum of 4 points, and the first and last points must be the same.", + "type": "array", + "items": { + "$ref": "#/components/schemas/GeoLineString" + }, + "nullable": true + } + } + }, + "GeoLineString": { + "description": "Ordered sequence of GeoPoints representing the line", + "type": "object", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GeoPoint" + } + } + } + }, + "ValuesCount": { + "description": "Values count filter request", + "type": "object", + "properties": { + "lt": { + "description": "point.key.length() < values_count.lt", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "gt": { + "description": "point.key.length() > values_count.gt", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "gte": { + "description": "point.key.length() >= values_count.gte", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "lte": { + "description": "point.key.length() <= values_count.lte", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "IsEmptyCondition": { + "description": "Select points with empty payload for a specified field", + "type": "object", + "required": [ + "is_empty" + ], + "properties": { + "is_empty": { + "$ref": "#/components/schemas/PayloadField" + } + } + }, + "PayloadField": { + "description": "Payload field", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "description": "Payload field name", + "type": "string" + } + } + }, + "IsNullCondition": { + "description": "Select points with null payload for a specified field", + "type": "object", + "required": [ + "is_null" + ], + "properties": { + "is_null": { + "$ref": "#/components/schemas/PayloadField" + } + } + }, + "HasIdCondition": { + "description": "ID-based filtering condition", + "type": "object", + "required": [ + "has_id" + ], + "properties": { + "has_id": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "uniqueItems": true + } + } + }, + "NestedCondition": { + "type": "object", + "required": [ + "nested" + ], + "properties": { + "nested": { + "$ref": "#/components/schemas/Nested" + } + } + }, + "Nested": { + "description": "Select points with payload for a specified nested field", + "type": "object", + "required": [ + "filter", + "key" + ], + "properties": { + "key": { + "type": "string" + }, + "filter": { + "$ref": "#/components/schemas/Filter" + } + } + }, + "MinShould": { + "type": "object", + "required": [ + "conditions", + "min_count" + ], + "properties": { + "conditions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Condition" + } + }, + "min_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "SearchParams": { + "description": "Additional parameters of the search", + "type": "object", + "properties": { + "hnsw_ef": { + "description": "Params relevant to HNSW index Size of the beam in a beam-search. Larger the value - more accurate the result, more time required for search.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "exact": { + "description": "Search without approximation. If set to true, search may run long but with exact results.", + "default": false, + "type": "boolean" + }, + "quantization": { + "description": "Quantization params", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationSearchParams" + }, + { + "nullable": true + } + ] + }, + "indexed_only": { + "description": "If enabled, the engine will only perform search among indexed or small segments. Using this option prevents slow searches in case of delayed index, but does not guarantee that all uploaded vectors will be included in search results", + "default": false, + "type": "boolean" + } + } + }, + "QuantizationSearchParams": { + "description": "Additional parameters of the search", + "type": "object", + "properties": { + "ignore": { + "description": "If true, quantized vectors are ignored. Default is false.", + "default": false, + "type": "boolean" + }, + "rescore": { + "description": "If true, use original vectors to re-score top-k results. Might require more time in case if original vectors are stored on disk. If not set, qdrant decides automatically apply rescoring or not.", + "default": null, + "type": "boolean", + "nullable": true + }, + "oversampling": { + "description": "Oversampling factor for quantization. Default is 1.0.\n\nDefines how many extra vectors should be pre-selected using quantized index, and then re-scored using original vectors.\n\nFor example, if `oversampling` is 2.4 and `limit` is 100, then 240 vectors will be pre-selected using quantized index, and then top-100 will be returned after re-scoring.", + "default": null, + "type": "number", + "format": "double", + "minimum": 1, + "nullable": true + } + } + }, + "ScoredPoint": { + "description": "Search result", + "type": "object", + "required": [ + "id", + "score", + "version" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "version": { + "description": "Point version", + "type": "integer", + "format": "uint64", + "minimum": 0, + "example": 3 + }, + "score": { + "description": "Points vector distance to the query vector", + "type": "number", + "format": "float", + "example": 0.75 + }, + "payload": { + "description": "Payload - values assigned to the point", + "anyOf": [ + { + "$ref": "#/components/schemas/Payload" + }, + { + "nullable": true + } + ] + }, + "vector": { + "description": "Vector of the point", + "anyOf": [ + { + "$ref": "#/components/schemas/VectorStruct" + }, + { + "nullable": true + } + ] + }, + "shard_key": { + "description": "Shard Key", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKey" + }, + { + "nullable": true + } + ] + }, + "order_value": { + "description": "Order-by value", + "anyOf": [ + { + "$ref": "#/components/schemas/OrderValue" + }, + { + "nullable": true + } + ] + } + } + }, + "UpdateResult": { + "type": "object", + "required": [ + "status" + ], + "properties": { + "operation_id": { + "description": "Sequential number of the operation", + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "status": { + "$ref": "#/components/schemas/UpdateStatus" + } + } + }, + "UpdateStatus": { + "description": "`Acknowledged` - Request is saved to WAL and will be process in a queue. `Completed` - Request is completed, changes are actual.", + "type": "string", + "enum": [ + "acknowledged", + "completed" + ] + }, + "RecommendRequest": { + "description": "Recommendation request. Provides positive and negative examples of the vectors, which can be ids of points that are already stored in the collection, raw vectors, or even ids and vectors combined.\n\nService should look for the points which are closer to positive examples and at the same time further to negative examples. The concrete way of how to compare negative and positive distances is up to the `strategy` chosen.", + "type": "object", + "required": [ + "limit" + ], + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "positive": { + "description": "Look for vectors closest to those", + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/RecommendExample" + } + }, + "negative": { + "description": "Try to avoid vectors like this", + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/RecommendExample" + } + }, + "strategy": { + "description": "How to use positive and negative examples to find the results", + "anyOf": [ + { + "$ref": "#/components/schemas/RecommendStrategy" + }, + { + "nullable": true + } + ] + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Additional search params", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "limit": { + "description": "Max number of result to return", + "type": "integer", + "format": "uint", + "minimum": 1 + }, + "offset": { + "description": "Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "description": "Options for specifying which vectors to include into response. Default is false.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.", + "type": "number", + "format": "float", + "nullable": true + }, + "using": { + "description": "Define which vector to use for recommendation, if not specified - try to use default vector", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/UsingVector" + }, + { + "nullable": true + } + ] + }, + "lookup_from": { + "description": "The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/LookupLocation" + }, + { + "nullable": true + } + ] + } + } + }, + "RecommendExample": { + "anyOf": [ + { + "$ref": "#/components/schemas/ExtendedPointId" + }, + { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + { + "$ref": "#/components/schemas/SparseVector" + } + ] + }, + "RecommendStrategy": { + "description": "How to use positive and negative examples to find the results, default is `average_vector`:\n\n* `average_vector` - Average positive and negative vectors and create a single query with the formula `query = avg_pos + avg_pos - avg_neg`. Then performs normal search.\n\n* `best_score` - Uses custom search objective. Each candidate is compared against all examples, its score is then chosen from the `max(max_pos_score, max_neg_score)`. If the `max_neg_score` is chosen then it is squared and negated, otherwise it is just the `max_pos_score`.", + "type": "string", + "enum": [ + "average_vector", + "best_score" + ] + }, + "UsingVector": { + "anyOf": [ + { + "type": "string" + } + ] + }, + "LookupLocation": { + "description": "Defines a location to use for looking up the vector. Specifies collection and vector field name.", + "type": "object", + "required": [ + "collection" + ], + "properties": { + "collection": { + "description": "Name of the collection used for lookup", + "type": "string" + }, + "vector": { + "description": "Optional name of the vector field within the collection. If not provided, the default vector field will be used.", + "default": null, + "type": "string", + "nullable": true + }, + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "ScrollRequest": { + "description": "Scroll request - paginate over all points which matches given condition", + "type": "object", + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "offset": { + "description": "Start ID to read points from.", + "anyOf": [ + { + "$ref": "#/components/schemas/ExtendedPointId" + }, + { + "nullable": true + } + ] + }, + "limit": { + "description": "Page size. Default: 10", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "filter": { + "description": "Look only for points which satisfies this conditions. If not provided - all points.", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is true.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "$ref": "#/components/schemas/WithVector" + }, + "order_by": { + "description": "Order the records by a payload field.", + "anyOf": [ + { + "$ref": "#/components/schemas/OrderByInterface" + }, + { + "nullable": true + } + ] + } + } + }, + "OrderByInterface": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/OrderBy" + } + ] + }, + "OrderBy": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "description": "Payload key to order by", + "type": "string" + }, + "direction": { + "description": "Direction of ordering: `asc` or `desc`. Default is ascending.", + "anyOf": [ + { + "$ref": "#/components/schemas/Direction" + }, + { + "nullable": true + } + ] + }, + "start_from": { + "description": "Which payload value to start scrolling from. Default is the lowest value for `asc` and the highest for `desc`", + "anyOf": [ + { + "$ref": "#/components/schemas/StartFrom" + }, + { + "nullable": true + } + ] + } + } + }, + "Direction": { + "type": "string", + "enum": [ + "asc", + "desc" + ] + }, + "StartFrom": { + "anyOf": [ + { + "type": "integer", + "format": "int64" + }, + { + "type": "number", + "format": "double" + }, + { + "type": "string", + "format": "date-time" + } + ] + }, + "ScrollResult": { + "description": "Result of the points read request", + "type": "object", + "required": [ + "points" + ], + "properties": { + "points": { + "description": "List of retrieved points", + "type": "array", + "items": { + "$ref": "#/components/schemas/Record" + }, + "example": [ + { + "id": 40, + "payload": { + "city": "London", + "color": "green" + }, + "vector": [ + 0.875, + 0.140625, + 0.897599995136261 + ], + "shard_key": "region_1" + }, + { + "id": 41, + "payload": { + "city": "Paris", + "color": "red" + }, + "vector": [ + 0.75, + 0.640625, + 0.8945000171661377 + ], + "shard_key": "region_1" + } + ] + }, + "next_page_offset": { + "description": "Offset which should be used to retrieve a next page result", + "anyOf": [ + { + "$ref": "#/components/schemas/ExtendedPointId" + }, + { + "nullable": true + } + ] + } + } + }, + "CreateCollection": { + "description": "Operation for creating new collection and (optionally) specify index params", + "type": "object", + "properties": { + "vectors": { + "$ref": "#/components/schemas/VectorsConfig" + }, + "shard_number": { + "description": "For auto sharding: Number of shards in collection. - Default is 1 for standalone, otherwise equal to the number of nodes - Minimum is 1\n\nFor custom sharding: Number of shards in collection per shard group. - Default is 1, meaning that each shard key will be mapped to a single shard - Minimum is 1", + "default": null, + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "sharding_method": { + "description": "Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/ShardingMethod" + }, + { + "nullable": true + } + ] + }, + "replication_factor": { + "description": "Number of shards replicas. Default is 1 Minimum is 1", + "default": null, + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "write_consistency_factor": { + "description": "Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will make the collection more resilient to inconsistencies, but will also make it fail if not enough replicas are available. Does not have any performance impact.", + "default": null, + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "on_disk_payload": { + "description": "If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM.", + "default": null, + "type": "boolean", + "nullable": true + }, + "hnsw_config": { + "description": "Custom params for HNSW index. If none - values from service configuration file are used.", + "anyOf": [ + { + "$ref": "#/components/schemas/HnswConfigDiff" + }, + { + "nullable": true + } + ] + }, + "wal_config": { + "description": "Custom params for WAL. If none - values from service configuration file are used.", + "anyOf": [ + { + "$ref": "#/components/schemas/WalConfigDiff" + }, + { + "nullable": true + } + ] + }, + "optimizers_config": { + "description": "Custom params for Optimizers. If none - values from service configuration file are used.", + "anyOf": [ + { + "$ref": "#/components/schemas/OptimizersConfigDiff" + }, + { + "nullable": true + } + ] + }, + "init_from": { + "description": "Specify other collection to copy data from.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/InitFrom" + }, + { + "nullable": true + } + ] + }, + "quantization_config": { + "description": "Quantization parameters. If none - quantization is disabled.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationConfig" + }, + { + "nullable": true + } + ] + }, + "sparse_vectors": { + "description": "Sparse vector data config.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/SparseVectorParams" + }, + "nullable": true + } + } + }, + "WalConfigDiff": { + "type": "object", + "properties": { + "wal_capacity_mb": { + "description": "Size of a single WAL segment in MB", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "wal_segments_ahead": { + "description": "Number of WAL segments to create ahead of actually used ones", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "OptimizersConfigDiff": { + "type": "object", + "properties": { + "deleted_threshold": { + "description": "The minimal fraction of deleted vectors in a segment, required to perform segment optimization", + "type": "number", + "format": "double", + "nullable": true + }, + "vacuum_min_vector_number": { + "description": "The minimal number of vectors in a segment, required to perform segment optimization", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "default_segment_number": { + "description": "Target amount of segments optimizer will try to keep. Real amount of segments may vary depending on multiple parameters: - Amount of stored points - Current write RPS\n\nIt is recommended to select default number of segments as a factor of the number of search threads, so that each segment would be handled evenly by one of the threads If `default_segment_number = 0`, will be automatically selected by the number of available CPUs", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "max_segment_size": { + "description": "Do not create segments larger this size (in kilobytes). Large segments might require disproportionately long indexation times, therefore it makes sense to limit the size of segments.\n\nIf indexation speed have more priority for your - make this parameter lower. If search speed is more important - make this parameter higher. Note: 1Kb = 1 vector of size 256", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "memmap_threshold": { + "description": "Maximum size (in kilobytes) of vectors to store in-memory per segment. Segments larger than this threshold will be stored as read-only memmaped file.\n\nMemmap storage is disabled by default, to enable it, set this threshold to a reasonable value.\n\nTo disable memmap storage, set this to `0`.\n\nNote: 1Kb = 1 vector of size 256", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "indexing_threshold": { + "description": "Maximum size (in kilobytes) of vectors allowed for plain index, exceeding this threshold will enable vector indexing\n\nDefault value is 20,000, based on .\n\nTo disable vector indexing, set to `0`.\n\nNote: 1kB = 1 vector of size 256.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "flush_interval_sec": { + "description": "Minimum interval between forced flushes.", + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "max_optimization_threads": { + "description": "Max number of threads (jobs) for running optimizations per shard. Note: each optimization job will also use `max_indexing_threads` threads by itself for index building. If null - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "InitFrom": { + "description": "Operation for creating new collection and (optionally) specify index params", + "type": "object", + "required": [ + "collection" + ], + "properties": { + "collection": { + "type": "string" + } + } + }, + "UpdateCollection": { + "description": "Operation for updating parameters of the existing collection", + "type": "object", + "properties": { + "vectors": { + "description": "Map of vector data parameters to update for each named vector. To update parameters in a collection having a single unnamed vector, use an empty string as name.", + "anyOf": [ + { + "$ref": "#/components/schemas/VectorsConfigDiff" + }, + { + "nullable": true + } + ] + }, + "optimizers_config": { + "description": "Custom params for Optimizers. If none - it is left unchanged. This operation is blocking, it will only proceed once all current optimizations are complete", + "anyOf": [ + { + "$ref": "#/components/schemas/OptimizersConfigDiff" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Collection base params. If none - it is left unchanged.", + "anyOf": [ + { + "$ref": "#/components/schemas/CollectionParamsDiff" + }, + { + "nullable": true + } + ] + }, + "hnsw_config": { + "description": "HNSW parameters to update for the collection index. If none - it is left unchanged.", + "anyOf": [ + { + "$ref": "#/components/schemas/HnswConfigDiff" + }, + { + "nullable": true + } + ] + }, + "quantization_config": { + "description": "Quantization parameters to update. If none - it is left unchanged.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationConfigDiff" + }, + { + "nullable": true + } + ] + }, + "sparse_vectors": { + "description": "Map of sparse vector data parameters to update for each sparse vector.", + "anyOf": [ + { + "$ref": "#/components/schemas/SparseVectorsConfig" + }, + { + "nullable": true + } + ] + } + } + }, + "VectorsConfigDiff": { + "description": "Vector update params for multiple vectors\n\n{ \"vector_name\": { \"hnsw_config\": { \"m\": 8 } } }", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/VectorParamsDiff" + } + }, + "VectorParamsDiff": { + "type": "object", + "properties": { + "hnsw_config": { + "description": "Update params for HNSW index. If empty object - it will be unset.", + "anyOf": [ + { + "$ref": "#/components/schemas/HnswConfigDiff" + }, + { + "nullable": true + } + ] + }, + "quantization_config": { + "description": "Update params for quantization. If none - it is left unchanged.", + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationConfigDiff" + }, + { + "nullable": true + } + ] + }, + "on_disk": { + "description": "If true, vectors are served from disk, improving RAM usage at the cost of latency", + "type": "boolean", + "nullable": true + } + } + }, + "QuantizationConfigDiff": { + "anyOf": [ + { + "$ref": "#/components/schemas/ScalarQuantization" + }, + { + "$ref": "#/components/schemas/ProductQuantization" + }, + { + "$ref": "#/components/schemas/BinaryQuantization" + }, + { + "$ref": "#/components/schemas/Disabled" + } + ] + }, + "Disabled": { + "type": "string", + "enum": [ + "Disabled" + ] + }, + "CollectionParamsDiff": { + "type": "object", + "properties": { + "replication_factor": { + "description": "Number of replicas for each shard", + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "write_consistency_factor": { + "description": "Minimal number successful responses from replicas to consider operation successful", + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "read_fan_out_factor": { + "description": "Fan-out every read request to these many additional remote nodes (and return first available response)", + "type": "integer", + "format": "uint32", + "minimum": 0, + "nullable": true + }, + "on_disk_payload": { + "description": "If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM.", + "default": null, + "type": "boolean", + "nullable": true + } + } + }, + "SparseVectorsConfig": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/SparseVectorParams" + } + }, + "ChangeAliasesOperation": { + "description": "Operation for performing changes of collection aliases. Alias changes are atomic, meaning that no collection modifications can happen between alias operations.", + "type": "object", + "required": [ + "actions" + ], + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AliasOperations" + } + } + } + }, + "AliasOperations": { + "description": "Group of all the possible operations related to collection aliases", + "anyOf": [ + { + "$ref": "#/components/schemas/CreateAliasOperation" + }, + { + "$ref": "#/components/schemas/DeleteAliasOperation" + }, + { + "$ref": "#/components/schemas/RenameAliasOperation" + } + ] + }, + "CreateAliasOperation": { + "type": "object", + "required": [ + "create_alias" + ], + "properties": { + "create_alias": { + "$ref": "#/components/schemas/CreateAlias" + } + } + }, + "CreateAlias": { + "description": "Create alternative name for a collection. Collection will be available under both names for search, retrieve,", + "type": "object", + "required": [ + "alias_name", + "collection_name" + ], + "properties": { + "collection_name": { + "type": "string" + }, + "alias_name": { + "type": "string" + } + } + }, + "DeleteAliasOperation": { + "description": "Delete alias if exists", + "type": "object", + "required": [ + "delete_alias" + ], + "properties": { + "delete_alias": { + "$ref": "#/components/schemas/DeleteAlias" + } + } + }, + "DeleteAlias": { + "description": "Delete alias if exists", + "type": "object", + "required": [ + "alias_name" + ], + "properties": { + "alias_name": { + "type": "string" + } + } + }, + "RenameAliasOperation": { + "description": "Change alias to a new one", + "type": "object", + "required": [ + "rename_alias" + ], + "properties": { + "rename_alias": { + "$ref": "#/components/schemas/RenameAlias" + } + } + }, + "RenameAlias": { + "description": "Change alias to a new one", + "type": "object", + "required": [ + "new_alias_name", + "old_alias_name" + ], + "properties": { + "old_alias_name": { + "type": "string" + }, + "new_alias_name": { + "type": "string" + } + } + }, + "CreateFieldIndex": { + "type": "object", + "required": [ + "field_name" + ], + "properties": { + "field_name": { + "type": "string" + }, + "field_schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/PayloadFieldSchema" + }, + { + "nullable": true + } + ] + } + } + }, + "PayloadFieldSchema": { + "anyOf": [ + { + "$ref": "#/components/schemas/PayloadSchemaType" + }, + { + "$ref": "#/components/schemas/PayloadSchemaParams" + } + ] + }, + "PointsSelector": { + "anyOf": [ + { + "$ref": "#/components/schemas/PointIdsList" + }, + { + "$ref": "#/components/schemas/FilterSelector" + } + ] + }, + "PointIdsList": { + "type": "object", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + } + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "FilterSelector": { + "type": "object", + "required": [ + "filter" + ], + "properties": { + "filter": { + "$ref": "#/components/schemas/Filter" + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "PointInsertOperations": { + "anyOf": [ + { + "$ref": "#/components/schemas/PointsBatch" + }, + { + "$ref": "#/components/schemas/PointsList" + } + ] + }, + "PointsBatch": { + "type": "object", + "required": [ + "batch" + ], + "properties": { + "batch": { + "$ref": "#/components/schemas/Batch" + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "Batch": { + "type": "object", + "required": [ + "ids", + "vectors" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + } + }, + "vectors": { + "$ref": "#/components/schemas/BatchVectorStruct" + }, + "payloads": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/Payload" + }, + { + "nullable": true + } + ] + }, + "nullable": true + } + } + }, + "BatchVectorStruct": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + } + }, + { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Vector" + } + } + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Document" + } + } + ] + }, + "PointsList": { + "type": "object", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PointStruct" + } + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "PointStruct": { + "type": "object", + "required": [ + "id", + "vector" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "vector": { + "$ref": "#/components/schemas/VectorStruct" + }, + "payload": { + "description": "Payload values (optional)", + "anyOf": [ + { + "$ref": "#/components/schemas/Payload" + }, + { + "nullable": true + } + ] + } + } + }, + "SetPayload": { + "description": "This data structure is used in API interface and applied across multiple shards", + "type": "object", + "required": [ + "payload" + ], + "properties": { + "payload": { + "$ref": "#/components/schemas/Payload" + }, + "points": { + "description": "Assigns payload to each point in this list", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "nullable": true + }, + "filter": { + "description": "Assigns payload to each point that satisfy this filter condition", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "key": { + "description": "Assigns payload to each point that satisfy this path of property", + "type": "string", + "nullable": true + } + } + }, + "DeletePayload": { + "description": "This data structure is used in API interface and applied across multiple shards", + "type": "object", + "required": [ + "keys" + ], + "properties": { + "keys": { + "description": "List of payload keys to remove from payload", + "type": "array", + "items": { + "type": "string" + } + }, + "points": { + "description": "Deletes values from each point in this list", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "nullable": true + }, + "filter": { + "description": "Deletes values from points that satisfy this filter condition", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "ClusterStatus": { + "description": "Information about current cluster status and structure", + "oneOf": [ + { + "type": "object", + "required": [ + "status" + ], + "properties": { + "status": { + "type": "string", + "enum": [ + "disabled" + ] + } + } + }, + { + "description": "Description of enabled cluster", + "type": "object", + "required": [ + "consensus_thread_status", + "message_send_failures", + "peer_id", + "peers", + "raft_info", + "status" + ], + "properties": { + "status": { + "type": "string", + "enum": [ + "enabled" + ] + }, + "peer_id": { + "description": "ID of this peer", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "peers": { + "description": "Peers composition of the cluster with main information", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/PeerInfo" + } + }, + "raft_info": { + "$ref": "#/components/schemas/RaftInfo" + }, + "consensus_thread_status": { + "$ref": "#/components/schemas/ConsensusThreadStatus" + }, + "message_send_failures": { + "description": "Consequent failures of message send operations in consensus by peer address. On the first success to send to that peer - entry is removed from this hashmap.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MessageSendErrors" + } + } + } + } + ] + }, + "PeerInfo": { + "description": "Information of a peer in the cluster", + "type": "object", + "required": [ + "uri" + ], + "properties": { + "uri": { + "type": "string" + } + } + }, + "RaftInfo": { + "description": "Summary information about the current raft state", + "type": "object", + "required": [ + "commit", + "is_voter", + "pending_operations", + "term" + ], + "properties": { + "term": { + "description": "Raft divides time into terms of arbitrary length, each beginning with an election. If a candidate wins the election, it remains the leader for the rest of the term. The term number increases monotonically. Each server stores the current term number which is also exchanged in every communication.", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "commit": { + "description": "The index of the latest committed (finalized) operation that this peer is aware of.", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "pending_operations": { + "description": "Number of consensus operations pending to be applied on this peer", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "leader": { + "description": "Leader of the current term", + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "role": { + "description": "Role of this peer in the current term", + "anyOf": [ + { + "$ref": "#/components/schemas/StateRole" + }, + { + "nullable": true + } + ] + }, + "is_voter": { + "description": "Is this peer a voter or a learner", + "type": "boolean" + } + } + }, + "StateRole": { + "description": "Role of the peer in the consensus", + "type": "string", + "enum": [ + "Follower", + "Candidate", + "Leader", + "PreCandidate" + ] + }, + "ConsensusThreadStatus": { + "description": "Information about current consensus thread status", + "oneOf": [ + { + "type": "object", + "required": [ + "consensus_thread_status", + "last_update" + ], + "properties": { + "consensus_thread_status": { + "type": "string", + "enum": [ + "working" + ] + }, + "last_update": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "consensus_thread_status" + ], + "properties": { + "consensus_thread_status": { + "type": "string", + "enum": [ + "stopped" + ] + } + } + }, + { + "type": "object", + "required": [ + "consensus_thread_status", + "err" + ], + "properties": { + "consensus_thread_status": { + "type": "string", + "enum": [ + "stopped_with_err" + ] + }, + "err": { + "type": "string" + } + } + } + ] + }, + "MessageSendErrors": { + "description": "Message send failures for a particular peer", + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "latest_error": { + "type": "string", + "nullable": true + }, + "latest_error_timestamp": { + "description": "Timestamp of the latest error", + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "SnapshotDescription": { + "type": "object", + "required": [ + "name", + "size" + ], + "properties": { + "name": { + "type": "string" + }, + "creation_time": { + "type": "string", + "format": "partial-date-time", + "nullable": true + }, + "size": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "checksum": { + "type": "string", + "nullable": true + } + }, + "example": { + "name": "my-collection-3766212330831337-2024-07-22-08-31-55.snapshot", + "creation_time": "2022-08-04T10:49:10", + "size": 1000000, + "checksum": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0" + } + }, + "CountRequest": { + "description": "Count Request Counts the number of points which satisfy the given filter. If filter is not provided, the count of all points in the collection will be returned.", + "type": "object", + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "exact": { + "description": "If true, count exact number of points. If false, count approximate number of points faster. Approximate count might be unreliable during the indexing process. Default: true", + "default": true, + "type": "boolean" + } + } + }, + "CountResult": { + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "description": "Number of points which satisfy the conditions", + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "CollectionClusterInfo": { + "description": "Current clustering distribution for the collection", + "type": "object", + "required": [ + "local_shards", + "peer_id", + "remote_shards", + "shard_count", + "shard_transfers" + ], + "properties": { + "peer_id": { + "description": "ID of this peer", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "shard_count": { + "description": "Total number of shards", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "local_shards": { + "description": "Local shards", + "type": "array", + "items": { + "$ref": "#/components/schemas/LocalShardInfo" + } + }, + "remote_shards": { + "description": "Remote shards", + "type": "array", + "items": { + "$ref": "#/components/schemas/RemoteShardInfo" + } + }, + "shard_transfers": { + "description": "Shard transfers", + "type": "array", + "items": { + "$ref": "#/components/schemas/ShardTransferInfo" + } + }, + "resharding_operations": { + "description": "Resharding operations", + "type": "array", + "items": { + "$ref": "#/components/schemas/ReshardingInfo" + }, + "nullable": true + } + } + }, + "LocalShardInfo": { + "type": "object", + "required": [ + "points_count", + "shard_id", + "state" + ], + "properties": { + "shard_id": { + "description": "Local shard id", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "shard_key": { + "description": "User-defined sharding key", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKey" + }, + { + "nullable": true + } + ] + }, + "points_count": { + "description": "Number of points in the shard", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "state": { + "$ref": "#/components/schemas/ReplicaState" + } + } + }, + "ReplicaState": { + "description": "State of the single shard within a replica set.", + "type": "string", + "enum": [ + "Active", + "Dead", + "Partial", + "Initializing", + "Listener", + "PartialSnapshot", + "Recovery" + ] + }, + "RemoteShardInfo": { + "type": "object", + "required": [ + "peer_id", + "shard_id", + "state" + ], + "properties": { + "shard_id": { + "description": "Remote shard id", + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "shard_key": { + "description": "User-defined sharding key", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKey" + }, + { + "nullable": true + } + ] + }, + "peer_id": { + "description": "Remote peer id", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "state": { + "$ref": "#/components/schemas/ReplicaState" + } + } + }, + "ShardTransferInfo": { + "type": "object", + "required": [ + "from", + "shard_id", + "sync", + "to" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "from": { + "description": "Source peer id", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "to": { + "description": "Destination peer id", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "sync": { + "description": "If `true` transfer is a synchronization of a replicas If `false` transfer is a moving of a shard from one peer to another", + "type": "boolean" + }, + "method": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardTransferMethod" + }, + { + "nullable": true + } + ] + }, + "comment": { + "description": "A human-readable report of the transfer progress. Available only on the source peer.", + "type": "string", + "nullable": true + } + } + }, + "ShardTransferMethod": { + "description": "Methods for transferring a shard from one node to another.", + "oneOf": [ + { + "description": "Stream all shard records in batches until the whole shard is transferred.", + "type": "string", + "enum": [ + "stream_records" + ] + }, + { + "description": "Snapshot the shard, transfer and restore it on the receiver.", + "type": "string", + "enum": [ + "snapshot" + ] + }, + { + "description": "Attempt to transfer shard difference by WAL delta.", + "type": "string", + "enum": [ + "wal_delta" + ] + } + ] + }, + "ReshardingInfo": { + "type": "object", + "required": [ + "direction", + "peer_id", + "shard_id" + ], + "properties": { + "direction": { + "$ref": "#/components/schemas/ReshardingDirection" + }, + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKey" + }, + { + "nullable": true + } + ] + }, + "comment": { + "description": "A human-readable report of the operation progress. Available only on the source peer.", + "type": "string", + "nullable": true + } + } + }, + "ReshardingDirection": { + "description": "Resharding direction, scale up or down in number of shards", + "oneOf": [ + { + "description": "Scale up, add a new shard", + "type": "string", + "enum": [ + "up" + ] + }, + { + "description": "Scale down, remove a shard", + "type": "string", + "enum": [ + "down" + ] + } + ] + }, + "TelemetryData": { + "type": "object", + "required": [ + "app", + "cluster", + "collections", + "id", + "requests" + ], + "properties": { + "id": { + "type": "string" + }, + "app": { + "$ref": "#/components/schemas/AppBuildTelemetry" + }, + "collections": { + "$ref": "#/components/schemas/CollectionsTelemetry" + }, + "cluster": { + "$ref": "#/components/schemas/ClusterTelemetry" + }, + "requests": { + "$ref": "#/components/schemas/RequestsTelemetry" + } + } + }, + "AppBuildTelemetry": { + "type": "object", + "required": [ + "name", + "startup", + "version" + ], + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "features": { + "anyOf": [ + { + "$ref": "#/components/schemas/AppFeaturesTelemetry" + }, + { + "nullable": true + } + ] + }, + "system": { + "anyOf": [ + { + "$ref": "#/components/schemas/RunningEnvironmentTelemetry" + }, + { + "nullable": true + } + ] + }, + "jwt_rbac": { + "type": "boolean", + "nullable": true + }, + "hide_jwt_dashboard": { + "type": "boolean", + "nullable": true + }, + "startup": { + "type": "string", + "format": "date-time" + } + } + }, + "AppFeaturesTelemetry": { + "type": "object", + "required": [ + "debug", + "recovery_mode", + "service_debug_feature", + "web_feature" + ], + "properties": { + "debug": { + "type": "boolean" + }, + "web_feature": { + "type": "boolean" + }, + "service_debug_feature": { + "type": "boolean" + }, + "recovery_mode": { + "type": "boolean" + } + } + }, + "RunningEnvironmentTelemetry": { + "type": "object", + "required": [ + "cpu_flags", + "is_docker" + ], + "properties": { + "distribution": { + "type": "string", + "nullable": true + }, + "distribution_version": { + "type": "string", + "nullable": true + }, + "is_docker": { + "type": "boolean" + }, + "cores": { + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "ram_size": { + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "disk_size": { + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "cpu_flags": { + "type": "string" + } + } + }, + "CollectionsTelemetry": { + "type": "object", + "required": [ + "number_of_collections" + ], + "properties": { + "number_of_collections": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "collections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CollectionTelemetryEnum" + }, + "nullable": true + } + } + }, + "CollectionTelemetryEnum": { + "anyOf": [ + { + "$ref": "#/components/schemas/CollectionTelemetry" + }, + { + "$ref": "#/components/schemas/CollectionsAggregatedTelemetry" + } + ] + }, + "CollectionTelemetry": { + "type": "object", + "required": [ + "config", + "id", + "init_time_ms", + "resharding", + "shards", + "transfers" + ], + "properties": { + "id": { + "type": "string" + }, + "init_time_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "config": { + "$ref": "#/components/schemas/CollectionConfig" + }, + "shards": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReplicaSetTelemetry" + } + }, + "transfers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ShardTransferInfo" + } + }, + "resharding": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReshardingInfo" + } + } + } + }, + "ReplicaSetTelemetry": { + "type": "object", + "required": [ + "id", + "remote", + "replicate_states" + ], + "properties": { + "id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "local": { + "anyOf": [ + { + "$ref": "#/components/schemas/LocalShardTelemetry" + }, + { + "nullable": true + } + ] + }, + "remote": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RemoteShardTelemetry" + } + }, + "replicate_states": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/ReplicaState" + } + } + } + }, + "LocalShardTelemetry": { + "type": "object", + "required": [ + "optimizations", + "segments", + "total_optimized_points" + ], + "properties": { + "variant_name": { + "type": "string", + "nullable": true + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardStatus" + }, + { + "nullable": true + } + ] + }, + "total_optimized_points": { + "description": "Total number of optimized points since the last start.", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "segments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SegmentTelemetry" + } + }, + "optimizations": { + "$ref": "#/components/schemas/OptimizerTelemetry" + } + } + }, + "ShardStatus": { + "description": "Current state of the shard (supports same states as the collection) `Green` - all good. `Yellow` - optimization is running, 'Grey' - optimizations are possible but not triggered, `Red` - some operations failed and was not recovered", + "type": "string", + "enum": [ + "green", + "yellow", + "grey", + "red" + ] + }, + "SegmentTelemetry": { + "type": "object", + "required": [ + "config", + "info", + "payload_field_indices", + "vector_index_searches" + ], + "properties": { + "info": { + "$ref": "#/components/schemas/SegmentInfo" + }, + "config": { + "$ref": "#/components/schemas/SegmentConfig" + }, + "vector_index_searches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorIndexSearchesTelemetry" + } + }, + "payload_field_indices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PayloadIndexTelemetry" + } + } + } + }, + "SegmentInfo": { + "description": "Aggregated information about segment", + "type": "object", + "required": [ + "disk_usage_bytes", + "index_schema", + "is_appendable", + "num_deleted_vectors", + "num_indexed_vectors", + "num_points", + "num_vectors", + "ram_usage_bytes", + "segment_type", + "vector_data" + ], + "properties": { + "segment_type": { + "$ref": "#/components/schemas/SegmentType" + }, + "num_vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "num_points": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "num_indexed_vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "num_deleted_vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "ram_usage_bytes": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "disk_usage_bytes": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "is_appendable": { + "type": "boolean" + }, + "index_schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/PayloadIndexInfo" + } + }, + "vector_data": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/VectorDataInfo" + } + } + } + }, + "SegmentType": { + "description": "Type of segment", + "type": "string", + "enum": [ + "plain", + "indexed", + "special" + ] + }, + "VectorDataInfo": { + "type": "object", + "required": [ + "num_deleted_vectors", + "num_indexed_vectors", + "num_vectors" + ], + "properties": { + "num_vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "num_indexed_vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "num_deleted_vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "SegmentConfig": { + "type": "object", + "required": [ + "payload_storage_type" + ], + "properties": { + "vector_data": { + "default": {}, + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/VectorDataConfig" + } + }, + "sparse_vector_data": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/SparseVectorDataConfig" + } + }, + "payload_storage_type": { + "$ref": "#/components/schemas/PayloadStorageType" + } + } + }, + "VectorDataConfig": { + "description": "Config of single vector data storage", + "type": "object", + "required": [ + "distance", + "index", + "size", + "storage_type" + ], + "properties": { + "size": { + "description": "Size/dimensionality of the vectors used", + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "distance": { + "$ref": "#/components/schemas/Distance" + }, + "storage_type": { + "$ref": "#/components/schemas/VectorStorageType" + }, + "index": { + "$ref": "#/components/schemas/Indexes" + }, + "quantization_config": { + "description": "Vector specific quantization config that overrides collection config", + "anyOf": [ + { + "$ref": "#/components/schemas/QuantizationConfig" + }, + { + "nullable": true + } + ] + }, + "multivector_config": { + "description": "Vector specific configuration to enable multiple vectors per point", + "anyOf": [ + { + "$ref": "#/components/schemas/MultiVectorConfig" + }, + { + "nullable": true + } + ] + }, + "datatype": { + "description": "Vector specific configuration to set specific storage element type", + "anyOf": [ + { + "$ref": "#/components/schemas/VectorStorageDatatype" + }, + { + "nullable": true + } + ] + } + } + }, + "VectorStorageType": { + "description": "Storage types for vectors", + "oneOf": [ + { + "description": "Storage in memory (RAM)\n\nWill be very fast at the cost of consuming a lot of memory.", + "type": "string", + "enum": [ + "Memory" + ] + }, + { + "description": "Storage in mmap file, not appendable\n\nSearch performance is defined by disk speed and the fraction of vectors that fit in memory.", + "type": "string", + "enum": [ + "Mmap" + ] + }, + { + "description": "Storage in chunked mmap files, appendable\n\nSearch performance is defined by disk speed and the fraction of vectors that fit in memory.", + "type": "string", + "enum": [ + "ChunkedMmap" + ] + }, + { + "description": "Same as `ChunkedMmap`, but vectors are forced to be locked in RAM In this way we avoid cold requests to disk, but risk to run out of memory\n\nDesigned as a replacement for `Memory`, which doesn't depend on RocksDB", + "type": "string", + "enum": [ + "InRamChunkedMmap" + ] + } + ] + }, + "Indexes": { + "description": "Vector index configuration", + "oneOf": [ + { + "description": "Do not use any index, scan whole vector collection during search. Guarantee 100% precision, but may be time consuming on large collections.", + "type": "object", + "required": [ + "options", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "plain" + ] + }, + "options": { + "type": "object" + } + } + }, + { + "description": "Use filterable HNSW index for approximate search. Is very fast even on a very huge collections, but require additional space to store index and additional time to build it.", + "type": "object", + "required": [ + "options", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "hnsw" + ] + }, + "options": { + "$ref": "#/components/schemas/HnswConfig" + } + } + } + ] + }, + "VectorStorageDatatype": { + "description": "Storage types for vectors", + "type": "string", + "enum": [ + "float32", + "float16", + "uint8" + ] + }, + "SparseVectorDataConfig": { + "description": "Config of single sparse vector data storage", + "type": "object", + "required": [ + "index" + ], + "properties": { + "index": { + "$ref": "#/components/schemas/SparseIndexConfig" + } + } + }, + "SparseIndexConfig": { + "description": "Configuration for sparse inverted index.", + "type": "object", + "required": [ + "index_type" + ], + "properties": { + "full_scan_threshold": { + "description": "We prefer a full scan search upto (excluding) this number of vectors.\n\nNote: this is number of vectors, not KiloBytes.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "index_type": { + "$ref": "#/components/schemas/SparseIndexType" + }, + "datatype": { + "description": "Datatype used to store weights in the index.", + "anyOf": [ + { + "$ref": "#/components/schemas/VectorStorageDatatype" + }, + { + "nullable": true + } + ] + } + } + }, + "SparseIndexType": { + "description": "Sparse index types", + "oneOf": [ + { + "description": "Mutable RAM sparse index", + "type": "string", + "enum": [ + "MutableRam" + ] + }, + { + "description": "Immutable RAM sparse index", + "type": "string", + "enum": [ + "ImmutableRam" + ] + }, + { + "description": "Mmap sparse index", + "type": "string", + "enum": [ + "Mmap" + ] + } + ] + }, + "PayloadStorageType": { + "description": "Type of payload storage", + "oneOf": [ + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "in_memory" + ] + } + } + }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "on_disk" + ] + } + } + } + ] + }, + "VectorIndexSearchesTelemetry": { + "type": "object", + "required": [ + "filtered_exact", + "filtered_large_cardinality", + "filtered_plain", + "filtered_small_cardinality", + "filtered_sparse", + "unfiltered_exact", + "unfiltered_hnsw", + "unfiltered_plain", + "unfiltered_sparse" + ], + "properties": { + "index_name": { + "type": "string", + "nullable": true + }, + "unfiltered_plain": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "unfiltered_hnsw": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "unfiltered_sparse": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "filtered_plain": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "filtered_small_cardinality": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "filtered_large_cardinality": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "filtered_exact": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "filtered_sparse": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "unfiltered_exact": { + "$ref": "#/components/schemas/OperationDurationStatistics" + } + } + }, + "OperationDurationStatistics": { + "type": "object", + "required": [ + "count", + "total_duration_micros" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "fail_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "avg_duration_micros": { + "description": "The average time taken by 128 latest operations, calculated as a weighted mean.", + "type": "number", + "format": "float", + "nullable": true + }, + "min_duration_micros": { + "description": "The minimum duration of the operations across all the measurements.", + "type": "number", + "format": "float", + "nullable": true + }, + "max_duration_micros": { + "description": "The maximum duration of the operations across all the measurements.", + "type": "number", + "format": "float", + "nullable": true + }, + "total_duration_micros": { + "description": "The total duration of all operations in microseconds.", + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "last_responded": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "PayloadIndexTelemetry": { + "type": "object", + "required": [ + "points_count", + "points_values_count" + ], + "properties": { + "field_name": { + "type": "string", + "nullable": true + }, + "points_values_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "points_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "histogram_bucket_size": { + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + } + } + }, + "OptimizerTelemetry": { + "type": "object", + "required": [ + "log", + "optimizations", + "status" + ], + "properties": { + "status": { + "$ref": "#/components/schemas/OptimizersStatus" + }, + "optimizations": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "log": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TrackerTelemetry" + } + } + } + }, + "TrackerTelemetry": { + "description": "Tracker object used in telemetry", + "type": "object", + "required": [ + "name", + "segment_ids", + "start_at", + "status" + ], + "properties": { + "name": { + "description": "Name of the optimizer", + "type": "string" + }, + "segment_ids": { + "description": "Segment IDs being optimized", + "type": "array", + "items": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + }, + "status": { + "$ref": "#/components/schemas/TrackerStatus" + }, + "start_at": { + "description": "Start time of the optimizer", + "type": "string", + "format": "date-time" + }, + "end_at": { + "description": "End time of the optimizer", + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "TrackerStatus": { + "description": "Represents the current state of the optimizer being tracked", + "oneOf": [ + { + "type": "string", + "enum": [ + "optimizing", + "done" + ] + }, + { + "type": "object", + "required": [ + "cancelled" + ], + "properties": { + "cancelled": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "RemoteShardTelemetry": { + "type": "object", + "required": [ + "searches", + "shard_id", + "updates" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "searches": { + "$ref": "#/components/schemas/OperationDurationStatistics" + }, + "updates": { + "$ref": "#/components/schemas/OperationDurationStatistics" + } + } + }, + "CollectionsAggregatedTelemetry": { + "type": "object", + "required": [ + "optimizers_status", + "params", + "vectors" + ], + "properties": { + "vectors": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "optimizers_status": { + "$ref": "#/components/schemas/OptimizersStatus" + }, + "params": { + "$ref": "#/components/schemas/CollectionParams" + } + } + }, + "ClusterTelemetry": { + "type": "object", + "required": [ + "enabled" + ], + "properties": { + "enabled": { + "type": "boolean" + }, + "status": { + "anyOf": [ + { + "$ref": "#/components/schemas/ClusterStatusTelemetry" + }, + { + "nullable": true + } + ] + }, + "config": { + "anyOf": [ + { + "$ref": "#/components/schemas/ClusterConfigTelemetry" + }, + { + "nullable": true + } + ] + }, + "peers": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/PeerInfo" + }, + "nullable": true + }, + "metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + } + }, + "ClusterStatusTelemetry": { + "type": "object", + "required": [ + "commit", + "consensus_thread_status", + "is_voter", + "number_of_peers", + "pending_operations", + "term" + ], + "properties": { + "number_of_peers": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "term": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "commit": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "pending_operations": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "role": { + "anyOf": [ + { + "$ref": "#/components/schemas/StateRole" + }, + { + "nullable": true + } + ] + }, + "is_voter": { + "type": "boolean" + }, + "peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "consensus_thread_status": { + "$ref": "#/components/schemas/ConsensusThreadStatus" + } + } + }, + "ClusterConfigTelemetry": { + "type": "object", + "required": [ + "consensus", + "grpc_timeout_ms", + "p2p" + ], + "properties": { + "grpc_timeout_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "p2p": { + "$ref": "#/components/schemas/P2pConfigTelemetry" + }, + "consensus": { + "$ref": "#/components/schemas/ConsensusConfigTelemetry" + } + } + }, + "P2pConfigTelemetry": { + "type": "object", + "required": [ + "connection_pool_size" + ], + "properties": { + "connection_pool_size": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "ConsensusConfigTelemetry": { + "type": "object", + "required": [ + "bootstrap_timeout_sec", + "max_message_queue_size", + "tick_period_ms" + ], + "properties": { + "max_message_queue_size": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "tick_period_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "bootstrap_timeout_sec": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "RequestsTelemetry": { + "type": "object", + "required": [ + "grpc", + "rest" + ], + "properties": { + "rest": { + "$ref": "#/components/schemas/WebApiTelemetry" + }, + "grpc": { + "$ref": "#/components/schemas/GrpcTelemetry" + } + } + }, + "WebApiTelemetry": { + "type": "object", + "required": [ + "responses" + ], + "properties": { + "responses": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/OperationDurationStatistics" + } + } + } + } + }, + "GrpcTelemetry": { + "type": "object", + "required": [ + "responses" + ], + "properties": { + "responses": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/OperationDurationStatistics" + } + } + } + }, + "ClusterOperations": { + "anyOf": [ + { + "$ref": "#/components/schemas/MoveShardOperation" + }, + { + "$ref": "#/components/schemas/ReplicateShardOperation" + }, + { + "$ref": "#/components/schemas/AbortTransferOperation" + }, + { + "$ref": "#/components/schemas/DropReplicaOperation" + }, + { + "$ref": "#/components/schemas/CreateShardingKeyOperation" + }, + { + "$ref": "#/components/schemas/DropShardingKeyOperation" + }, + { + "$ref": "#/components/schemas/RestartTransferOperation" + } + ] + }, + "MoveShardOperation": { + "type": "object", + "required": [ + "move_shard" + ], + "properties": { + "move_shard": { + "$ref": "#/components/schemas/MoveShard" + } + } + }, + "MoveShard": { + "type": "object", + "required": [ + "from_peer_id", + "shard_id", + "to_peer_id" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "to_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "method": { + "description": "Method for transferring the shard from one node to another", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardTransferMethod" + }, + { + "nullable": true + } + ] + } + } + }, + "ReplicateShardOperation": { + "type": "object", + "required": [ + "replicate_shard" + ], + "properties": { + "replicate_shard": { + "$ref": "#/components/schemas/ReplicateShard" + } + } + }, + "ReplicateShard": { + "type": "object", + "required": [ + "from_peer_id", + "shard_id", + "to_peer_id" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "to_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "method": { + "description": "Method for transferring the shard from one node to another", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardTransferMethod" + }, + { + "nullable": true + } + ] + } + } + }, + "AbortTransferOperation": { + "type": "object", + "required": [ + "abort_transfer" + ], + "properties": { + "abort_transfer": { + "$ref": "#/components/schemas/AbortShardTransfer" + } + } + }, + "AbortShardTransfer": { + "type": "object", + "required": [ + "from_peer_id", + "shard_id", + "to_peer_id" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "to_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "from_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "DropReplicaOperation": { + "type": "object", + "required": [ + "drop_replica" + ], + "properties": { + "drop_replica": { + "$ref": "#/components/schemas/Replica" + } + } + }, + "Replica": { + "type": "object", + "required": [ + "peer_id", + "shard_id" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "CreateShardingKeyOperation": { + "type": "object", + "required": [ + "create_sharding_key" + ], + "properties": { + "create_sharding_key": { + "$ref": "#/components/schemas/CreateShardingKey" + } + } + }, + "CreateShardingKey": { + "type": "object", + "required": [ + "shard_key" + ], + "properties": { + "shard_key": { + "$ref": "#/components/schemas/ShardKey" + }, + "shards_number": { + "description": "How many shards to create for this key If not specified, will use the default value from config", + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "replication_factor": { + "description": "How many replicas to create for each shard If not specified, will use the default value from config", + "type": "integer", + "format": "uint32", + "minimum": 1, + "nullable": true + }, + "placement": { + "description": "Placement of shards for this key List of peer ids, that can be used to place shards for this key If not specified, will be randomly placed among all peers", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "nullable": true + } + } + }, + "DropShardingKeyOperation": { + "type": "object", + "required": [ + "drop_sharding_key" + ], + "properties": { + "drop_sharding_key": { + "$ref": "#/components/schemas/DropShardingKey" + } + } + }, + "DropShardingKey": { + "type": "object", + "required": [ + "shard_key" + ], + "properties": { + "shard_key": { + "$ref": "#/components/schemas/ShardKey" + } + } + }, + "RestartTransferOperation": { + "type": "object", + "required": [ + "restart_transfer" + ], + "properties": { + "restart_transfer": { + "$ref": "#/components/schemas/RestartTransfer" + } + } + }, + "RestartTransfer": { + "type": "object", + "required": [ + "from_peer_id", + "method", + "shard_id", + "to_peer_id" + ], + "properties": { + "shard_id": { + "type": "integer", + "format": "uint32", + "minimum": 0 + }, + "from_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "to_peer_id": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "method": { + "$ref": "#/components/schemas/ShardTransferMethod" + } + } + }, + "SearchRequestBatch": { + "type": "object", + "required": [ + "searches" + ], + "properties": { + "searches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchRequest" + } + } + } + }, + "RecommendRequestBatch": { + "type": "object", + "required": [ + "searches" + ], + "properties": { + "searches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RecommendRequest" + } + } + } + }, + "LocksOption": { + "type": "object", + "required": [ + "write" + ], + "properties": { + "error_message": { + "type": "string", + "nullable": true + }, + "write": { + "type": "boolean" + } + } + }, + "SnapshotRecover": { + "type": "object", + "required": [ + "location" + ], + "properties": { + "location": { + "description": "Examples: - URL `http://localhost:8080/collections/my_collection/snapshots/my_snapshot` - Local path `file:///qdrant/snapshots/test_collection-2022-08-04-10-49-10.snapshot`", + "type": "string", + "format": "uri" + }, + "priority": { + "description": "Defines which data should be used as a source of truth if there are other replicas in the cluster. If set to `Snapshot`, the snapshot will be used as a source of truth, and the current state will be overwritten. If set to `Replica`, the current state will be used as a source of truth, and after recovery if will be synchronized with the snapshot.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/SnapshotPriority" + }, + { + "nullable": true + } + ] + }, + "checksum": { + "description": "Optional SHA256 checksum to verify snapshot integrity before recovery.", + "default": null, + "type": "string", + "nullable": true + }, + "api_key": { + "description": "Optional API key used when fetching the snapshot from a remote URL.", + "default": null, + "type": "string", + "nullable": true + } + } + }, + "SnapshotPriority": { + "description": "Defines source of truth for snapshot recovery: `NoSync` means - restore snapshot without *any* additional synchronization. `Snapshot` means - prefer snapshot data over the current state. `Replica` means - prefer existing data over the snapshot.", + "type": "string", + "enum": [ + "no_sync", + "snapshot", + "replica" + ] + }, + "CollectionsAliasesResponse": { + "type": "object", + "required": [ + "aliases" + ], + "properties": { + "aliases": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AliasDescription" + } + } + } + }, + "AliasDescription": { + "type": "object", + "required": [ + "alias_name", + "collection_name" + ], + "properties": { + "alias_name": { + "type": "string" + }, + "collection_name": { + "type": "string" + } + }, + "example": { + "alias_name": "blogs-title", + "collection_name": "arivx-title" + } + }, + "WriteOrdering": { + "description": "Defines write ordering guarantees for collection operations\n\n* `weak` - write operations may be reordered, works faster, default\n\n* `medium` - write operations go through dynamically selected leader, may be inconsistent for a short period of time in case of leader change\n\n* `strong` - Write operations go through the permanent leader, consistent, but may be unavailable if leader is down", + "type": "string", + "enum": [ + "weak", + "medium", + "strong" + ] + }, + "ReadConsistency": { + "description": "Read consistency parameter\n\nDefines how many replicas should be queried to get the result\n\n* `N` - send N random request and return points, which present on all of them\n\n* `majority` - send N/2+1 random request and return points, which present on all of them\n\n* `quorum` - send requests to all nodes and return points which present on majority of them\n\n* `all` - send requests to all nodes and return points which present on all of them\n\nDefault value is `Factor(1)`", + "anyOf": [ + { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + { + "$ref": "#/components/schemas/ReadConsistencyType" + } + ] + }, + "ReadConsistencyType": { + "description": "* `majority` - send N/2+1 random request and return points, which present on all of them\n\n* `quorum` - send requests to all nodes and return points which present on majority of nodes\n\n* `all` - send requests to all nodes and return points which present on all nodes", + "type": "string", + "enum": [ + "majority", + "quorum", + "all" + ] + }, + "UpdateVectors": { + "type": "object", + "required": [ + "points" + ], + "properties": { + "points": { + "description": "Points with named vectors", + "type": "array", + "items": { + "$ref": "#/components/schemas/PointVectors" + }, + "minItems": 1 + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "PointVectors": { + "type": "object", + "required": [ + "id", + "vector" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "vector": { + "$ref": "#/components/schemas/VectorStruct" + } + } + }, + "DeleteVectors": { + "type": "object", + "required": [ + "vector" + ], + "properties": { + "points": { + "description": "Deletes values from each point in this list", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "nullable": true + }, + "filter": { + "description": "Deletes values from points that satisfy this filter condition", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "vector": { + "description": "Vector names", + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + }, + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + } + } + }, + "PointGroup": { + "type": "object", + "required": [ + "hits", + "id" + ], + "properties": { + "hits": { + "description": "Scored points that have the same value of the group_by key", + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + }, + "id": { + "$ref": "#/components/schemas/GroupId" + }, + "lookup": { + "description": "Record that has been looked up using the group id", + "anyOf": [ + { + "$ref": "#/components/schemas/Record" + }, + { + "nullable": true + } + ] + } + } + }, + "GroupId": { + "description": "Value of the group_by key, shared across all the hits in the group", + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + { + "type": "integer", + "format": "int64" + } + ] + }, + "SearchGroupsRequest": { + "type": "object", + "required": [ + "group_by", + "group_size", + "limit", + "vector" + ], + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "vector": { + "$ref": "#/components/schemas/NamedVectorStruct" + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Additional search params", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "description": "Options for specifying which vectors to include into response. Default is false.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.", + "type": "number", + "format": "float", + "nullable": true + }, + "group_by": { + "description": "Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups.", + "type": "string", + "minLength": 1 + }, + "group_size": { + "description": "Maximum amount of points to return per group", + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "limit": { + "description": "Maximum amount of groups to return", + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "with_lookup": { + "description": "Look for points in another collection using the group ids", + "anyOf": [ + { + "$ref": "#/components/schemas/WithLookupInterface" + }, + { + "nullable": true + } + ] + } + } + }, + "WithLookupInterface": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/components/schemas/WithLookup" + } + ] + }, + "WithLookup": { + "type": "object", + "required": [ + "collection" + ], + "properties": { + "collection": { + "description": "Name of the collection to use for points lookup", + "type": "string" + }, + "with_payload": { + "description": "Options for specifying which payload to include (or not)", + "default": true, + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vectors": { + "description": "Options for specifying which vectors to include (or not)", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + } + } + }, + "RecommendGroupsRequest": { + "type": "object", + "required": [ + "group_by", + "group_size", + "limit" + ], + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "positive": { + "description": "Look for vectors closest to those", + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/RecommendExample" + } + }, + "negative": { + "description": "Try to avoid vectors like this", + "default": [], + "type": "array", + "items": { + "$ref": "#/components/schemas/RecommendExample" + } + }, + "strategy": { + "description": "How to use positive and negative examples to find the results", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/RecommendStrategy" + }, + { + "nullable": true + } + ] + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Additional search params", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "description": "Options for specifying which vectors to include into response. Default is false.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.", + "type": "number", + "format": "float", + "nullable": true + }, + "using": { + "description": "Define which vector to use for recommendation, if not specified - try to use default vector", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/UsingVector" + }, + { + "nullable": true + } + ] + }, + "lookup_from": { + "description": "The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/LookupLocation" + }, + { + "nullable": true + } + ] + }, + "group_by": { + "description": "Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups.", + "type": "string", + "minLength": 1 + }, + "group_size": { + "description": "Maximum amount of points to return per group", + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "limit": { + "description": "Maximum amount of groups to return", + "type": "integer", + "format": "uint32", + "minimum": 1 + }, + "with_lookup": { + "description": "Look for points in another collection using the group ids", + "anyOf": [ + { + "$ref": "#/components/schemas/WithLookupInterface" + }, + { + "nullable": true + } + ] + } + } + }, + "GroupsResult": { + "type": "object", + "required": [ + "groups" + ], + "properties": { + "groups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PointGroup" + } + } + } + }, + "UpdateOperations": { + "type": "object", + "required": [ + "operations" + ], + "properties": { + "operations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpdateOperation" + } + } + } + }, + "UpdateOperation": { + "anyOf": [ + { + "$ref": "#/components/schemas/UpsertOperation" + }, + { + "$ref": "#/components/schemas/DeleteOperation" + }, + { + "$ref": "#/components/schemas/SetPayloadOperation" + }, + { + "$ref": "#/components/schemas/OverwritePayloadOperation" + }, + { + "$ref": "#/components/schemas/DeletePayloadOperation" + }, + { + "$ref": "#/components/schemas/ClearPayloadOperation" + }, + { + "$ref": "#/components/schemas/UpdateVectorsOperation" + }, + { + "$ref": "#/components/schemas/DeleteVectorsOperation" + } + ] + }, + "UpsertOperation": { + "type": "object", + "required": [ + "upsert" + ], + "properties": { + "upsert": { + "$ref": "#/components/schemas/PointInsertOperations" + } + } + }, + "DeleteOperation": { + "type": "object", + "required": [ + "delete" + ], + "properties": { + "delete": { + "$ref": "#/components/schemas/PointsSelector" + } + } + }, + "SetPayloadOperation": { + "type": "object", + "required": [ + "set_payload" + ], + "properties": { + "set_payload": { + "$ref": "#/components/schemas/SetPayload" + } + } + }, + "OverwritePayloadOperation": { + "type": "object", + "required": [ + "overwrite_payload" + ], + "properties": { + "overwrite_payload": { + "$ref": "#/components/schemas/SetPayload" + } + } + }, + "DeletePayloadOperation": { + "type": "object", + "required": [ + "delete_payload" + ], + "properties": { + "delete_payload": { + "$ref": "#/components/schemas/DeletePayload" + } + } + }, + "ClearPayloadOperation": { + "type": "object", + "required": [ + "clear_payload" + ], + "properties": { + "clear_payload": { + "$ref": "#/components/schemas/PointsSelector" + } + } + }, + "UpdateVectorsOperation": { + "type": "object", + "required": [ + "update_vectors" + ], + "properties": { + "update_vectors": { + "$ref": "#/components/schemas/UpdateVectors" + } + } + }, + "DeleteVectorsOperation": { + "type": "object", + "required": [ + "delete_vectors" + ], + "properties": { + "delete_vectors": { + "$ref": "#/components/schemas/DeleteVectors" + } + } + }, + "ShardSnapshotRecover": { + "type": "object", + "required": [ + "location" + ], + "properties": { + "location": { + "$ref": "#/components/schemas/ShardSnapshotLocation" + }, + "priority": { + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/SnapshotPriority" + }, + { + "nullable": true + } + ] + }, + "checksum": { + "description": "Optional SHA256 checksum to verify snapshot integrity before recovery.", + "default": null, + "type": "string", + "nullable": true + }, + "api_key": { + "description": "Optional API key used when fetching the snapshot from a remote URL.", + "default": null, + "type": "string", + "nullable": true + } + } + }, + "ShardSnapshotLocation": { + "anyOf": [ + { + "type": "string", + "format": "uri" + }, + { + "type": "string" + } + ] + }, + "DiscoverRequest": { + "description": "Use context and a target to find the most similar points, constrained by the context.", + "type": "object", + "required": [ + "limit" + ], + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "target": { + "description": "Look for vectors closest to this.\n\nWhen using the target (with or without context), the integer part of the score represents the rank with respect to the context, while the decimal part of the score relates to the distance to the target.", + "anyOf": [ + { + "$ref": "#/components/schemas/RecommendExample" + }, + { + "nullable": true + } + ] + }, + "context": { + "description": "Pairs of { positive, negative } examples to constrain the search.\n\nWhen using only the context (without a target), a special search - called context search - is performed where pairs of points are used to generate a loss that guides the search towards the zone where most positive examples overlap. This means that the score minimizes the scenario of finding a point closer to a negative than to a positive part of a pair.\n\nSince the score of a context relates to loss, the maximum score a point can get is 0.0, and it becomes normal that many points can have a score of 0.0.\n\nFor discovery search (when including a target), the context part of the score for each pair is calculated +1 if the point is closer to a positive than to a negative part of a pair, and -1 otherwise.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ContextExamplePair" + }, + "nullable": true + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Additional search params", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "limit": { + "description": "Max number of result to return", + "type": "integer", + "format": "uint", + "minimum": 1 + }, + "offset": { + "description": "Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues.", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "with_payload": { + "description": "Select which payload to return with the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "with_vector": { + "description": "Options for specifying which vectors to include into response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "using": { + "description": "Define which vector to use for recommendation, if not specified - try to use default vector", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/UsingVector" + }, + { + "nullable": true + } + ] + }, + "lookup_from": { + "description": "The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/LookupLocation" + }, + { + "nullable": true + } + ] + } + } + }, + "ContextExamplePair": { + "type": "object", + "required": [ + "negative", + "positive" + ], + "properties": { + "positive": { + "$ref": "#/components/schemas/RecommendExample" + }, + "negative": { + "$ref": "#/components/schemas/RecommendExample" + } + } + }, + "DiscoverRequestBatch": { + "type": "object", + "required": [ + "searches" + ], + "properties": { + "searches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DiscoverRequest" + } + } + } + }, + "VersionInfo": { + "type": "object", + "required": [ + "title", + "version" + ], + "properties": { + "title": { + "type": "string" + }, + "version": { + "type": "string" + }, + "commit": { + "type": "string", + "nullable": true + } + } + }, + "CollectionExistence": { + "description": "State of existence of a collection, true = exists, false = does not exist", + "type": "object", + "required": [ + "exists" + ], + "properties": { + "exists": { + "type": "boolean" + } + } + }, + "QueryRequest": { + "type": "object", + "properties": { + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "prefetch": { + "description": "Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es).", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/Prefetch" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prefetch" + } + }, + { + "nullable": true + } + ] + }, + "query": { + "description": "Query to perform. If missing without prefetches, returns points ordered by their IDs.", + "anyOf": [ + { + "$ref": "#/components/schemas/QueryInterface" + }, + { + "nullable": true + } + ] + }, + "using": { + "description": "Define which vector name to use for querying. If missing, the default vector is used.", + "type": "string", + "nullable": true + }, + "filter": { + "description": "Filter conditions - return only those points that satisfy the specified conditions.", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Search params for when there is no prefetch", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Return points with scores better than this threshold.", + "type": "number", + "format": "float", + "nullable": true + }, + "limit": { + "description": "Max number of points to return. Default is 10.", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "offset": { + "description": "Offset of the result. Skip this many points. Default is 0", + "type": "integer", + "format": "uint", + "minimum": 0, + "nullable": true + }, + "with_vector": { + "description": "Options for specifying which vectors to include into the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "with_payload": { + "description": "Options for specifying which payload to include or not. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "lookup_from": { + "description": "The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/LookupLocation" + }, + { + "nullable": true + } + ] + } + } + }, + "Prefetch": { + "type": "object", + "properties": { + "prefetch": { + "description": "Sub-requests to perform first. If present, the query will be performed on the results of the prefetches.", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/Prefetch" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prefetch" + } + }, + { + "nullable": true + } + ] + }, + "query": { + "description": "Query to perform. If missing without prefetches, returns points ordered by their IDs.", + "anyOf": [ + { + "$ref": "#/components/schemas/QueryInterface" + }, + { + "nullable": true + } + ] + }, + "using": { + "description": "Define which vector name to use for querying. If missing, the default vector is used.", + "type": "string", + "nullable": true + }, + "filter": { + "description": "Filter conditions - return only those points that satisfy the specified conditions.", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Search params for when there is no prefetch", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Return points with scores better than this threshold.", + "type": "number", + "format": "float", + "nullable": true + }, + "limit": { + "description": "Max number of points to return. Default is 10.", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "lookup_from": { + "description": "The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/LookupLocation" + }, + { + "nullable": true + } + ] + } + } + }, + "QueryInterface": { + "anyOf": [ + { + "$ref": "#/components/schemas/VectorInput" + }, + { + "$ref": "#/components/schemas/Query" + } + ] + }, + "VectorInput": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + { + "$ref": "#/components/schemas/SparseVector" + }, + { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number", + "format": "float" + } + } + }, + { + "$ref": "#/components/schemas/ExtendedPointId" + }, + { + "$ref": "#/components/schemas/Document" + } + ] + }, + "Query": { + "anyOf": [ + { + "$ref": "#/components/schemas/NearestQuery" + }, + { + "$ref": "#/components/schemas/RecommendQuery" + }, + { + "$ref": "#/components/schemas/DiscoverQuery" + }, + { + "$ref": "#/components/schemas/ContextQuery" + }, + { + "$ref": "#/components/schemas/OrderByQuery" + }, + { + "$ref": "#/components/schemas/FusionQuery" + }, + { + "$ref": "#/components/schemas/SampleQuery" + } + ] + }, + "NearestQuery": { + "type": "object", + "required": [ + "nearest" + ], + "properties": { + "nearest": { + "$ref": "#/components/schemas/VectorInput" + } + } + }, + "RecommendQuery": { + "type": "object", + "required": [ + "recommend" + ], + "properties": { + "recommend": { + "$ref": "#/components/schemas/RecommendInput" + } + } + }, + "RecommendInput": { + "type": "object", + "properties": { + "positive": { + "description": "Look for vectors closest to the vectors from these points", + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorInput" + }, + "nullable": true + }, + "negative": { + "description": "Try to avoid vectors like the vector from these points", + "type": "array", + "items": { + "$ref": "#/components/schemas/VectorInput" + }, + "nullable": true + }, + "strategy": { + "description": "How to use the provided vectors to find the results", + "anyOf": [ + { + "$ref": "#/components/schemas/RecommendStrategy" + }, + { + "nullable": true + } + ] + } + } + }, + "DiscoverQuery": { + "type": "object", + "required": [ + "discover" + ], + "properties": { + "discover": { + "$ref": "#/components/schemas/DiscoverInput" + } + } + }, + "DiscoverInput": { + "type": "object", + "required": [ + "context", + "target" + ], + "properties": { + "target": { + "$ref": "#/components/schemas/VectorInput" + }, + "context": { + "description": "Search space will be constrained by these pairs of vectors", + "anyOf": [ + { + "$ref": "#/components/schemas/ContextPair" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContextPair" + } + }, + { + "nullable": true + } + ] + } + } + }, + "ContextPair": { + "type": "object", + "required": [ + "negative", + "positive" + ], + "properties": { + "positive": { + "$ref": "#/components/schemas/VectorInput" + }, + "negative": { + "$ref": "#/components/schemas/VectorInput" + } + } + }, + "ContextQuery": { + "type": "object", + "required": [ + "context" + ], + "properties": { + "context": { + "$ref": "#/components/schemas/ContextInput" + } + } + }, + "ContextInput": { + "anyOf": [ + { + "$ref": "#/components/schemas/ContextPair" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContextPair" + } + }, + { + "nullable": true + } + ] + }, + "OrderByQuery": { + "type": "object", + "required": [ + "order_by" + ], + "properties": { + "order_by": { + "$ref": "#/components/schemas/OrderByInterface" + } + } + }, + "FusionQuery": { + "type": "object", + "required": [ + "fusion" + ], + "properties": { + "fusion": { + "$ref": "#/components/schemas/Fusion" + } + } + }, + "Fusion": { + "description": "Fusion algorithm allows to combine results of multiple prefetches.\n\nAvailable fusion algorithms:\n\n* `rrf` - Reciprocal Rank Fusion * `dbsf` - Distribution-Based Score Fusion", + "type": "string", + "enum": [ + "rrf", + "dbsf" + ] + }, + "SampleQuery": { + "type": "object", + "required": [ + "sample" + ], + "properties": { + "sample": { + "$ref": "#/components/schemas/Sample" + } + } + }, + "Sample": { + "type": "string", + "enum": [ + "random" + ] + }, + "QueryRequestBatch": { + "type": "object", + "required": [ + "searches" + ], + "properties": { + "searches": { + "type": "array", + "items": { + "$ref": "#/components/schemas/QueryRequest" + } + } + } + }, + "QueryResponse": { + "type": "object", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ScoredPoint" + } + } + } + }, + "QueryGroupsRequest": { + "type": "object", + "required": [ + "group_by" + ], + "properties": { + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "prefetch": { + "description": "Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es).", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/Prefetch" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Prefetch" + } + }, + { + "nullable": true + } + ] + }, + "query": { + "description": "Query to perform. If missing without prefetches, returns points ordered by their IDs.", + "anyOf": [ + { + "$ref": "#/components/schemas/QueryInterface" + }, + { + "nullable": true + } + ] + }, + "using": { + "description": "Define which vector name to use for querying. If missing, the default vector is used.", + "type": "string", + "nullable": true + }, + "filter": { + "description": "Filter conditions - return only those points that satisfy the specified conditions.", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "params": { + "description": "Search params for when there is no prefetch", + "anyOf": [ + { + "$ref": "#/components/schemas/SearchParams" + }, + { + "nullable": true + } + ] + }, + "score_threshold": { + "description": "Return points with scores better than this threshold.", + "type": "number", + "format": "float", + "nullable": true + }, + "with_vector": { + "description": "Options for specifying which vectors to include into the response. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithVector" + }, + { + "nullable": true + } + ] + }, + "with_payload": { + "description": "Options for specifying which payload to include or not. Default is false.", + "anyOf": [ + { + "$ref": "#/components/schemas/WithPayloadInterface" + }, + { + "nullable": true + } + ] + }, + "lookup_from": { + "description": "The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection", + "default": null, + "anyOf": [ + { + "$ref": "#/components/schemas/LookupLocation" + }, + { + "nullable": true + } + ] + }, + "group_by": { + "description": "Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups.", + "type": "string", + "minLength": 1 + }, + "group_size": { + "description": "Maximum amount of points to return per group. Default is 3.", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "limit": { + "description": "Maximum amount of groups to return. Default is 10.", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "with_lookup": { + "description": "Look for points in another collection using the group ids", + "anyOf": [ + { + "$ref": "#/components/schemas/WithLookupInterface" + }, + { + "nullable": true + } + ] + } + } + }, + "SearchMatrixRequest": { + "type": "object", + "properties": { + "shard_key": { + "description": "Specify in which shards to look for the points, if not specified - look in all shards", + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "filter": { + "description": "Look only for points which satisfies this conditions", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "sample": { + "description": "How many points to select and search within. Default is 10.", + "type": "integer", + "format": "uint", + "minimum": 2, + "nullable": true + }, + "limit": { + "description": "How many neighbours per sample to find. Default is 3.", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "using": { + "description": "Define which vector name to use for querying. If missing, the default vector is used.", + "type": "string", + "nullable": true + } + } + }, + "SearchMatrixOffsetsResponse": { + "type": "object", + "required": [ + "ids", + "offsets_col", + "offsets_row", + "scores" + ], + "properties": { + "offsets_row": { + "description": "Row indices of the matrix", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "offsets_col": { + "description": "Column indices of the matrix", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "scores": { + "description": "Scores associated with matrix coordinates", + "type": "array", + "items": { + "type": "number", + "format": "float" + } + }, + "ids": { + "description": "Ids of the points in order", + "type": "array", + "items": { + "$ref": "#/components/schemas/ExtendedPointId" + } + } + } + }, + "SearchMatrixPairsResponse": { + "type": "object", + "required": [ + "pairs" + ], + "properties": { + "pairs": { + "description": "List of pairs of points with scores", + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchMatrixPair" + } + } + } + }, + "SearchMatrixPair": { + "description": "Pair of points (a, b) with score", + "type": "object", + "required": [ + "a", + "b", + "score" + ], + "properties": { + "a": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "b": { + "$ref": "#/components/schemas/ExtendedPointId" + }, + "score": { + "type": "number", + "format": "float" + } + } + }, + "FacetRequest": { + "type": "object", + "required": [ + "key" + ], + "properties": { + "shard_key": { + "anyOf": [ + { + "$ref": "#/components/schemas/ShardKeySelector" + }, + { + "nullable": true + } + ] + }, + "key": { + "description": "Payload key to use for faceting.", + "type": "string" + }, + "limit": { + "description": "Max number of hits to return. Default is 10.", + "type": "integer", + "format": "uint", + "minimum": 1, + "nullable": true + }, + "filter": { + "description": "Filter conditions - only consider points that satisfy these conditions.", + "anyOf": [ + { + "$ref": "#/components/schemas/Filter" + }, + { + "nullable": true + } + ] + }, + "exact": { + "description": "Whether to do a more expensive exact count for each of the values in the facet. Default is false.", + "type": "boolean", + "nullable": true + } + } + }, + "FacetResponse": { + "type": "object", + "required": [ + "hits" + ], + "properties": { + "hits": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FacetValueHit" + } + } + } + }, + "FacetValueHit": { + "type": "object", + "required": [ + "count", + "value" + ], + "properties": { + "value": { + "$ref": "#/components/schemas/FacetValue" + }, + "count": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + }, + "FacetValue": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "integer", + "format": "int64" + }, + { + "type": "boolean" + } + ] + } + } + } +} diff --git a/modules/openapi-generator/src/test/resources/3_0/crystal/scalar-defaults.yaml b/modules/openapi-generator/src/test/resources/3_0/crystal/scalar-defaults.yaml new file mode 100644 index 000000000000..8eb50fc49977 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/crystal/scalar-defaults.yaml @@ -0,0 +1,13 @@ +openapi: 3.0.1 +info: {title: Def, version: 1.0.0} +paths: {/x: {get: {operationId: getX, tags: [x], responses: {"200": {description: ok}}}}} +components: + schemas: + Widget: + type: object + properties: + size: {type: integer, default: 10} + label: {type: string, default: "hi"} + active: {type: boolean, default: true} + ratio: {type: number, default: 1.5} + created: {type: string, format: date-time, default: "2020-01-01T00:00:00Z"} diff --git a/samples/client/others/crystal-qdrant/.gitignore b/samples/client/others/crystal-qdrant/.gitignore new file mode 100644 index 000000000000..15f3b69381a3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/.gitignore @@ -0,0 +1,17 @@ +# Generated by: https://openapi-generator.tech +# + +/docs/ +/lib/ +/bin/ +/.shards/ +*.dwarf + +# Libraries don't need dependency lock +# Dependencies will be locked in applications that use them +/shard.lock + +/tmp/ + +# Spectator run artifact +.spectator-failures diff --git a/samples/client/others/crystal-qdrant/.openapi-generator-ignore b/samples/client/others/crystal-qdrant/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/others/crystal-qdrant/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/crystal-qdrant/.openapi-generator/FILES b/samples/client/others/crystal-qdrant/.openapi-generator/FILES new file mode 100644 index 000000000000..74586c986b63 --- /dev/null +++ b/samples/client/others/crystal-qdrant/.openapi-generator/FILES @@ -0,0 +1,350 @@ +.gitignore +README.md +git_push.sh +shard.yml +spec/spec_helper.cr +src/qdrant-api.cr +src/qdrant-api/api/aliases.cr +src/qdrant-api/api/cluster.cr +src/qdrant-api/api/cluster/peer.cr +src/qdrant-api/api/collections.cr +src/qdrant-api/api/collections/index.cr +src/qdrant-api/api/collections/points.cr +src/qdrant-api/api/collections/shards.cr +src/qdrant-api/api/collections/snapshots.cr +src/qdrant-api/api/healthz.cr +src/qdrant-api/api/issues.cr +src/qdrant-api/api/livez.cr +src/qdrant-api/api/locks.cr +src/qdrant-api/api/metrics.cr +src/qdrant-api/api/readyz.cr +src/qdrant-api/api/root.cr +src/qdrant-api/api/snapshots.cr +src/qdrant-api/api/telemetry.cr +src/qdrant-api/api_error.cr +src/qdrant-api/client.cr +src/qdrant-api/configuration.cr +src/qdrant-api/connection.cr +src/qdrant-api/models/abort_shard_transfer.cr +src/qdrant-api/models/abort_transfer_operation.cr +src/qdrant-api/models/alias_description.cr +src/qdrant-api/models/alias_operations.cr +src/qdrant-api/models/any_variants.cr +src/qdrant-api/models/app_build_telemetry.cr +src/qdrant-api/models/app_features_telemetry.cr +src/qdrant-api/models/batch.cr +src/qdrant-api/models/batch_payloads_inner.cr +src/qdrant-api/models/batch_update200_response.cr +src/qdrant-api/models/batch_vector_struct.cr +src/qdrant-api/models/binary_quantization.cr +src/qdrant-api/models/binary_quantization_config.cr +src/qdrant-api/models/bool_index_params.cr +src/qdrant-api/models/bool_index_type.cr +src/qdrant-api/models/change_aliases_operation.cr +src/qdrant-api/models/clear_payload_operation.cr +src/qdrant-api/models/cluster_config_telemetry.cr +src/qdrant-api/models/cluster_operations.cr +src/qdrant-api/models/cluster_status.cr +src/qdrant-api/models/cluster_status200_response.cr +src/qdrant-api/models/cluster_status_one_of.cr +src/qdrant-api/models/cluster_status_one_of1.cr +src/qdrant-api/models/cluster_status_telemetry.cr +src/qdrant-api/models/cluster_telemetry.cr +src/qdrant-api/models/collection_cluster_info.cr +src/qdrant-api/models/collection_cluster_info200_response.cr +src/qdrant-api/models/collection_config.cr +src/qdrant-api/models/collection_description.cr +src/qdrant-api/models/collection_existence.cr +src/qdrant-api/models/collection_exists200_response.cr +src/qdrant-api/models/collection_info.cr +src/qdrant-api/models/collection_params.cr +src/qdrant-api/models/collection_params_diff.cr +src/qdrant-api/models/collection_status.cr +src/qdrant-api/models/collection_telemetry.cr +src/qdrant-api/models/collection_telemetry_enum.cr +src/qdrant-api/models/collections_aggregated_telemetry.cr +src/qdrant-api/models/collections_aliases_response.cr +src/qdrant-api/models/collections_response.cr +src/qdrant-api/models/collections_telemetry.cr +src/qdrant-api/models/compression_ratio.cr +src/qdrant-api/models/condition.cr +src/qdrant-api/models/consensus_config_telemetry.cr +src/qdrant-api/models/consensus_thread_status.cr +src/qdrant-api/models/consensus_thread_status_one_of.cr +src/qdrant-api/models/consensus_thread_status_one_of1.cr +src/qdrant-api/models/consensus_thread_status_one_of2.cr +src/qdrant-api/models/context_example_pair.cr +src/qdrant-api/models/context_input.cr +src/qdrant-api/models/context_pair.cr +src/qdrant-api/models/context_query.cr +src/qdrant-api/models/count_points200_response.cr +src/qdrant-api/models/count_request.cr +src/qdrant-api/models/count_result.cr +src/qdrant-api/models/create_alias.cr +src/qdrant-api/models/create_alias_operation.cr +src/qdrant-api/models/create_collection.cr +src/qdrant-api/models/create_field_index.cr +src/qdrant-api/models/create_field_index200_response.cr +src/qdrant-api/models/create_shard_key200_response.cr +src/qdrant-api/models/create_sharding_key.cr +src/qdrant-api/models/create_sharding_key_operation.cr +src/qdrant-api/models/create_snapshot200_response.cr +src/qdrant-api/models/datatype.cr +src/qdrant-api/models/datetime_index_params.cr +src/qdrant-api/models/datetime_index_type.cr +src/qdrant-api/models/datetime_range.cr +src/qdrant-api/models/delete_alias.cr +src/qdrant-api/models/delete_alias_operation.cr +src/qdrant-api/models/delete_operation.cr +src/qdrant-api/models/delete_payload.cr +src/qdrant-api/models/delete_payload_operation.cr +src/qdrant-api/models/delete_vectors.cr +src/qdrant-api/models/delete_vectors_operation.cr +src/qdrant-api/models/direction.cr +src/qdrant-api/models/disabled.cr +src/qdrant-api/models/discover_input.cr +src/qdrant-api/models/discover_input_context.cr +src/qdrant-api/models/discover_query.cr +src/qdrant-api/models/discover_request.cr +src/qdrant-api/models/discover_request_batch.cr +src/qdrant-api/models/distance.cr +src/qdrant-api/models/document.cr +src/qdrant-api/models/drop_replica_operation.cr +src/qdrant-api/models/drop_sharding_key.cr +src/qdrant-api/models/drop_sharding_key_operation.cr +src/qdrant-api/models/error_response.cr +src/qdrant-api/models/error_response_status.cr +src/qdrant-api/models/extended_point_id.cr +src/qdrant-api/models/facet200_response.cr +src/qdrant-api/models/facet_request.cr +src/qdrant-api/models/facet_response.cr +src/qdrant-api/models/facet_value.cr +src/qdrant-api/models/facet_value_hit.cr +src/qdrant-api/models/field_condition.cr +src/qdrant-api/models/filter.cr +src/qdrant-api/models/filter_selector.cr +src/qdrant-api/models/filter_should.cr +src/qdrant-api/models/float_index_params.cr +src/qdrant-api/models/float_index_type.cr +src/qdrant-api/models/fusion.cr +src/qdrant-api/models/fusion_query.cr +src/qdrant-api/models/geo_bounding_box.cr +src/qdrant-api/models/geo_index_params.cr +src/qdrant-api/models/geo_index_type.cr +src/qdrant-api/models/geo_line_string.cr +src/qdrant-api/models/geo_point.cr +src/qdrant-api/models/geo_polygon.cr +src/qdrant-api/models/geo_radius.cr +src/qdrant-api/models/get_collection200_response.cr +src/qdrant-api/models/get_collection_aliases200_response.cr +src/qdrant-api/models/get_collections200_response.cr +src/qdrant-api/models/get_locks200_response.cr +src/qdrant-api/models/get_point200_response.cr +src/qdrant-api/models/get_points200_response.cr +src/qdrant-api/models/group_id.cr +src/qdrant-api/models/groups_result.cr +src/qdrant-api/models/grpc_telemetry.cr +src/qdrant-api/models/has_id_condition.cr +src/qdrant-api/models/hnsw_config.cr +src/qdrant-api/models/hnsw_config_diff.cr +src/qdrant-api/models/indexes.cr +src/qdrant-api/models/indexes_one_of.cr +src/qdrant-api/models/indexes_one_of1.cr +src/qdrant-api/models/init_from.cr +src/qdrant-api/models/integer_index_params.cr +src/qdrant-api/models/integer_index_type.cr +src/qdrant-api/models/is_empty_condition.cr +src/qdrant-api/models/is_null_condition.cr +src/qdrant-api/models/keyword_index_params.cr +src/qdrant-api/models/keyword_index_type.cr +src/qdrant-api/models/list_snapshots200_response.cr +src/qdrant-api/models/local_shard_info.cr +src/qdrant-api/models/local_shard_telemetry.cr +src/qdrant-api/models/locks_option.cr +src/qdrant-api/models/lookup_location.cr +src/qdrant-api/models/match.cr +src/qdrant-api/models/match_any.cr +src/qdrant-api/models/match_except.cr +src/qdrant-api/models/match_text.cr +src/qdrant-api/models/match_value.cr +src/qdrant-api/models/message_send_errors.cr +src/qdrant-api/models/min_should.cr +src/qdrant-api/models/modifier.cr +src/qdrant-api/models/move_shard.cr +src/qdrant-api/models/move_shard_operation.cr +src/qdrant-api/models/multi_vector_comparator.cr +src/qdrant-api/models/multi_vector_config.cr +src/qdrant-api/models/named_sparse_vector.cr +src/qdrant-api/models/named_vector.cr +src/qdrant-api/models/named_vector_struct.cr +src/qdrant-api/models/nearest_query.cr +src/qdrant-api/models/nested.cr +src/qdrant-api/models/nested_condition.cr +src/qdrant-api/models/operation_duration_statistics.cr +src/qdrant-api/models/optimizer_telemetry.cr +src/qdrant-api/models/optimizers_config.cr +src/qdrant-api/models/optimizers_config_diff.cr +src/qdrant-api/models/optimizers_status.cr +src/qdrant-api/models/optimizers_status_one_of.cr +src/qdrant-api/models/order_by.cr +src/qdrant-api/models/order_by_interface.cr +src/qdrant-api/models/order_by_query.cr +src/qdrant-api/models/order_value.cr +src/qdrant-api/models/overwrite_payload_operation.cr +src/qdrant-api/models/p2p_config_telemetry.cr +src/qdrant-api/models/payload_field.cr +src/qdrant-api/models/payload_field_schema.cr +src/qdrant-api/models/payload_index_info.cr +src/qdrant-api/models/payload_index_telemetry.cr +src/qdrant-api/models/payload_schema_params.cr +src/qdrant-api/models/payload_schema_type.cr +src/qdrant-api/models/payload_selector.cr +src/qdrant-api/models/payload_selector_exclude.cr +src/qdrant-api/models/payload_selector_include.cr +src/qdrant-api/models/payload_storage_type.cr +src/qdrant-api/models/payload_storage_type_one_of.cr +src/qdrant-api/models/payload_storage_type_one_of1.cr +src/qdrant-api/models/peer_info.cr +src/qdrant-api/models/point_group.cr +src/qdrant-api/models/point_ids_list.cr +src/qdrant-api/models/point_insert_operations.cr +src/qdrant-api/models/point_request.cr +src/qdrant-api/models/point_struct.cr +src/qdrant-api/models/point_vectors.cr +src/qdrant-api/models/points_batch.cr +src/qdrant-api/models/points_list.cr +src/qdrant-api/models/points_selector.cr +src/qdrant-api/models/prefetch.cr +src/qdrant-api/models/product_quantization.cr +src/qdrant-api/models/product_quantization_config.cr +src/qdrant-api/models/quantization_config.cr +src/qdrant-api/models/quantization_config_diff.cr +src/qdrant-api/models/quantization_search_params.cr +src/qdrant-api/models/query.cr +src/qdrant-api/models/query_batch_points200_response.cr +src/qdrant-api/models/query_groups_request.cr +src/qdrant-api/models/query_interface.cr +src/qdrant-api/models/query_points200_response.cr +src/qdrant-api/models/query_request.cr +src/qdrant-api/models/query_request_batch.cr +src/qdrant-api/models/query_request_prefetch.cr +src/qdrant-api/models/query_response.cr +src/qdrant-api/models/raft_info.cr +src/qdrant-api/models/range.cr +src/qdrant-api/models/range_interface.cr +src/qdrant-api/models/read_consistency.cr +src/qdrant-api/models/read_consistency_type.cr +src/qdrant-api/models/recommend_example.cr +src/qdrant-api/models/recommend_groups_request.cr +src/qdrant-api/models/recommend_input.cr +src/qdrant-api/models/recommend_query.cr +src/qdrant-api/models/recommend_request.cr +src/qdrant-api/models/recommend_request_batch.cr +src/qdrant-api/models/recommend_strategy.cr +src/qdrant-api/models/record.cr +src/qdrant-api/models/recover_from_uploaded_snapshot202_response.cr +src/qdrant-api/models/remote_shard_info.cr +src/qdrant-api/models/remote_shard_telemetry.cr +src/qdrant-api/models/rename_alias.cr +src/qdrant-api/models/rename_alias_operation.cr +src/qdrant-api/models/replica.cr +src/qdrant-api/models/replica_set_telemetry.cr +src/qdrant-api/models/replica_state.cr +src/qdrant-api/models/replicate_shard.cr +src/qdrant-api/models/replicate_shard_operation.cr +src/qdrant-api/models/requests_telemetry.cr +src/qdrant-api/models/resharding_direction.cr +src/qdrant-api/models/resharding_info.cr +src/qdrant-api/models/restart_transfer.cr +src/qdrant-api/models/restart_transfer_operation.cr +src/qdrant-api/models/running_environment_telemetry.cr +src/qdrant-api/models/sample.cr +src/qdrant-api/models/sample_query.cr +src/qdrant-api/models/scalar_quantization.cr +src/qdrant-api/models/scalar_quantization_config.cr +src/qdrant-api/models/scalar_type.cr +src/qdrant-api/models/scored_point.cr +src/qdrant-api/models/scroll_points200_response.cr +src/qdrant-api/models/scroll_request.cr +src/qdrant-api/models/scroll_result.cr +src/qdrant-api/models/search_batch_points200_response.cr +src/qdrant-api/models/search_groups_request.cr +src/qdrant-api/models/search_matrix_offsets200_response.cr +src/qdrant-api/models/search_matrix_offsets_response.cr +src/qdrant-api/models/search_matrix_pair.cr +src/qdrant-api/models/search_matrix_pairs200_response.cr +src/qdrant-api/models/search_matrix_pairs_response.cr +src/qdrant-api/models/search_matrix_request.cr +src/qdrant-api/models/search_params.cr +src/qdrant-api/models/search_point_groups200_response.cr +src/qdrant-api/models/search_points200_response.cr +src/qdrant-api/models/search_request.cr +src/qdrant-api/models/search_request_batch.cr +src/qdrant-api/models/segment_config.cr +src/qdrant-api/models/segment_info.cr +src/qdrant-api/models/segment_telemetry.cr +src/qdrant-api/models/segment_type.cr +src/qdrant-api/models/set_payload.cr +src/qdrant-api/models/set_payload_operation.cr +src/qdrant-api/models/shard_key.cr +src/qdrant-api/models/shard_key_selector.cr +src/qdrant-api/models/shard_snapshot_location.cr +src/qdrant-api/models/shard_snapshot_recover.cr +src/qdrant-api/models/shard_status.cr +src/qdrant-api/models/shard_transfer_info.cr +src/qdrant-api/models/shard_transfer_method.cr +src/qdrant-api/models/sharding_method.cr +src/qdrant-api/models/snapshot_description.cr +src/qdrant-api/models/snapshot_priority.cr +src/qdrant-api/models/snapshot_recover.cr +src/qdrant-api/models/sparse_index_config.cr +src/qdrant-api/models/sparse_index_params.cr +src/qdrant-api/models/sparse_index_type.cr +src/qdrant-api/models/sparse_vector.cr +src/qdrant-api/models/sparse_vector_data_config.cr +src/qdrant-api/models/sparse_vector_params.cr +src/qdrant-api/models/start_from.cr +src/qdrant-api/models/state_role.cr +src/qdrant-api/models/telemetry200_response.cr +src/qdrant-api/models/telemetry_data.cr +src/qdrant-api/models/text_index_params.cr +src/qdrant-api/models/text_index_type.cr +src/qdrant-api/models/tokenizer_type.cr +src/qdrant-api/models/tracker_status.cr +src/qdrant-api/models/tracker_status_one_of.cr +src/qdrant-api/models/tracker_telemetry.cr +src/qdrant-api/models/update_collection.cr +src/qdrant-api/models/update_operation.cr +src/qdrant-api/models/update_operations.cr +src/qdrant-api/models/update_result.cr +src/qdrant-api/models/update_status.cr +src/qdrant-api/models/update_vectors.cr +src/qdrant-api/models/update_vectors_operation.cr +src/qdrant-api/models/upsert_operation.cr +src/qdrant-api/models/uuid_index_params.cr +src/qdrant-api/models/uuid_index_type.cr +src/qdrant-api/models/value_variants.cr +src/qdrant-api/models/values_count.cr +src/qdrant-api/models/vector.cr +src/qdrant-api/models/vector_data_config.cr +src/qdrant-api/models/vector_data_info.cr +src/qdrant-api/models/vector_index_searches_telemetry.cr +src/qdrant-api/models/vector_input.cr +src/qdrant-api/models/vector_params.cr +src/qdrant-api/models/vector_params_diff.cr +src/qdrant-api/models/vector_storage_datatype.cr +src/qdrant-api/models/vector_storage_type.cr +src/qdrant-api/models/vector_struct.cr +src/qdrant-api/models/vectors_config.cr +src/qdrant-api/models/version_info.cr +src/qdrant-api/models/wal_config.cr +src/qdrant-api/models/wal_config_diff.cr +src/qdrant-api/models/web_api_telemetry.cr +src/qdrant-api/models/with_lookup.cr +src/qdrant-api/models/with_lookup_interface.cr +src/qdrant-api/models/with_payload_interface.cr +src/qdrant-api/models/with_vector.cr +src/qdrant-api/models/write_ordering.cr +src/qdrant-api/response.cr +src/qdrant-api/serializable.cr +src/qdrant-api/validation.cr diff --git a/samples/client/others/crystal-qdrant/.openapi-generator/VERSION b/samples/client/others/crystal-qdrant/.openapi-generator/VERSION new file mode 100644 index 000000000000..186c33c96ed8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.24.0-SNAPSHOT diff --git a/samples/client/others/crystal-qdrant/README.md b/samples/client/others/crystal-qdrant/README.md new file mode 100644 index 000000000000..09ddc16fa48a --- /dev/null +++ b/samples/client/others/crystal-qdrant/README.md @@ -0,0 +1,186 @@ +# qdrant-api + +The Crystal module for the Qdrant API + +API description for Qdrant vector search engine. + +This document describes CRUD and search operations on collections of points (vectors with payload). + +Qdrant supports any combinations of `should`, `min_should`, `must` and `must_not` conditions, which makes it possible to use in applications when object could not be described solely by vector. It could be location features, availability flags, and other custom properties businesses should take into account. +## Examples +This examples cover the most basic use-cases - collection creation and basic vector search. +### Create collection +First - let's create a collection with dot-production metric. +``` +curl -X PUT 'http://localhost:6333/collections/test_collection' \\ + -H 'Content-Type: application/json' \\ + --data-raw '{ + \"vectors\": { + \"size\": 4, + \"distance\": \"Dot\" + } + }' + +``` +Expected response: +``` +{ + \"result\": true, + \"status\": \"ok\", + \"time\": 0.031095451 +} +``` +We can ensure that collection was created: +``` +curl 'http://localhost:6333/collections/test_collection' +``` +Expected response: +``` +{ + \"result\": { + \"status\": \"green\", + \"vectors_count\": 0, + \"segments_count\": 5, + \"disk_data_size\": 0, + \"ram_data_size\": 0, + \"config\": { + \"params\": { + \"vectors\": { + \"size\": 4, + \"distance\": \"Dot\" + } + }, + \"hnsw_config\": { + \"m\": 16, + \"ef_construct\": 100, + \"full_scan_threshold\": 10000 + }, + \"optimizer_config\": { + \"deleted_threshold\": 0.2, + \"vacuum_min_vector_number\": 1000, + \"default_segment_number\": 2, + \"max_segment_size\": null, + \"memmap_threshold\": null, + \"indexing_threshold\": 20000, + \"flush_interval_sec\": 5, + \"max_optimization_threads\": null + }, + \"wal_config\": { + \"wal_capacity_mb\": 32, + \"wal_segments_ahead\": 0 + } + } + }, + \"status\": \"ok\", + \"time\": 2.1199e-05 +} +``` + +### Add points +Let's now add vectors with some payload: +``` +curl -L -X PUT 'http://localhost:6333/collections/test_collection/points?wait=true' \\ -H 'Content-Type: application/json' \\ --data-raw '{ + \"points\": [ + {\"id\": 1, \"vector\": [0.05, 0.61, 0.76, 0.74], \"payload\": {\"city\": \"Berlin\"}}, + {\"id\": 2, \"vector\": [0.19, 0.81, 0.75, 0.11], \"payload\": {\"city\": [\"Berlin\", \"London\"] }}, + {\"id\": 3, \"vector\": [0.36, 0.55, 0.47, 0.94], \"payload\": {\"city\": [\"Berlin\", \"Moscow\"] }}, + {\"id\": 4, \"vector\": [0.18, 0.01, 0.85, 0.80], \"payload\": {\"city\": [\"London\", \"Moscow\"] }}, + {\"id\": 5, \"vector\": [0.24, 0.18, 0.22, 0.44], \"payload\": {\"count\": [0]}}, + {\"id\": 6, \"vector\": [0.35, 0.08, 0.11, 0.44]} + ] +}' +``` +Expected response: +``` +{ + \"result\": { + \"operation_id\": 0, + \"status\": \"completed\" + }, + \"status\": \"ok\", + \"time\": 0.000206061 +} +``` +### Search with filtering +Let's start with a basic request: +``` +curl -L -X POST 'http://localhost:6333/collections/test_collection/points/search' \\ -H 'Content-Type: application/json' \\ --data-raw '{ + \"vector\": [0.2,0.1,0.9,0.7], + \"top\": 3 +}' +``` +Expected response: +``` +{ + \"result\": [ + { \"id\": 4, \"score\": 1.362, \"payload\": null, \"version\": 0 }, + { \"id\": 1, \"score\": 1.273, \"payload\": null, \"version\": 0 }, + { \"id\": 3, \"score\": 1.208, \"payload\": null, \"version\": 0 } + ], + \"status\": \"ok\", + \"time\": 0.000055785 +} +``` +But result is different if we add a filter: +``` +curl -L -X POST 'http://localhost:6333/collections/test_collection/points/search' \\ -H 'Content-Type: application/json' \\ --data-raw '{ + \"filter\": { + \"should\": [ + { + \"key\": \"city\", + \"match\": { + \"value\": \"London\" + } + } + ] + }, + \"vector\": [0.2, 0.1, 0.9, 0.7], + \"top\": 3 +}' +``` +Expected response: +``` +{ + \"result\": [ + { \"id\": 4, \"score\": 1.362, \"payload\": null, \"version\": 0 }, + { \"id\": 2, \"score\": 0.871, \"payload\": null, \"version\": 0 } + ], + \"status\": \"ok\", + \"time\": 0.000093972 +} +``` + + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: master +- Package version: 1.0.0 +- Generator version: 7.24.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CrystalClientCodegen + +## Installation + +### Install from Git + +Add the following to shard.yaml + +```yaml +dependencies: + qdrant-api: + github: GIT_USER_ID/GIT_REPO_ID + version: ~> 1.0.0 +``` + +## Development + +Install dependencies + +```shell +shards +``` + +Run the tests: + +```shell +crystal spec +``` diff --git a/samples/client/others/crystal-qdrant/git_push.sh b/samples/client/others/crystal-qdrant/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/client/others/crystal-qdrant/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/crystal-qdrant/shard.yml b/samples/client/others/crystal-qdrant/shard.yml new file mode 100644 index 000000000000..a6eef6bb759e --- /dev/null +++ b/samples/client/others/crystal-qdrant/shard.yml @@ -0,0 +1,25 @@ +name: qdrant-api + +version: 1.0.0 + +authors: + - + +description: | + - This shard maps to a REST API + +crystal: ">= 0.35.1" + +dependencies: + crest: + github: mamantoha/crest + version: ~> 1.3.13 + +development_dependencies: + ameba: + github: crystal-ameba/ameba + spectator: + gitlab: arctic-fox/spectator + version: ~> 0.12.0 + +license: unlicense diff --git a/samples/client/others/crystal-qdrant/spec/api/aliases_spec.cr b/samples/client/others/crystal-qdrant/spec/api/aliases_spec.cr new file mode 100644 index 000000000000..e93310b74f91 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/aliases_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Aliases +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Aliases" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Aliases.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Aliases) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/cluster/peer_spec.cr b/samples/client/others/crystal-qdrant/spec/api/cluster/peer_spec.cr new file mode 100644 index 000000000000..f4c6fc372f66 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/cluster/peer_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../../spec_helper" + +# Unit tests for Qdrant::Api::Cluster::Peer +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Cluster::Peer" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Cluster::Peer.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Cluster::Peer) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/cluster_spec.cr b/samples/client/others/crystal-qdrant/spec/api/cluster_spec.cr new file mode 100644 index 000000000000..056ef6035f83 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/cluster_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Cluster +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Cluster" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Cluster.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Cluster) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/collections/index_spec.cr b/samples/client/others/crystal-qdrant/spec/api/collections/index_spec.cr new file mode 100644 index 000000000000..c088c9ffaeb3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/collections/index_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../../spec_helper" + +# Unit tests for Qdrant::Api::Collections::Index +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Collections::Index" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Collections::Index.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Collections::Index) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/collections/points_spec.cr b/samples/client/others/crystal-qdrant/spec/api/collections/points_spec.cr new file mode 100644 index 000000000000..00392b3b0ee1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/collections/points_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../../spec_helper" + +# Unit tests for Qdrant::Api::Collections::Points +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Collections::Points" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Collections::Points.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Collections::Points) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/collections/shards_spec.cr b/samples/client/others/crystal-qdrant/spec/api/collections/shards_spec.cr new file mode 100644 index 000000000000..2dbe18a9ac4c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/collections/shards_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../../spec_helper" + +# Unit tests for Qdrant::Api::Collections::Shards +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Collections::Shards" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Collections::Shards.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Collections::Shards) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/collections/snapshots_spec.cr b/samples/client/others/crystal-qdrant/spec/api/collections/snapshots_spec.cr new file mode 100644 index 000000000000..5a01f0c7aba1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/collections/snapshots_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../../spec_helper" + +# Unit tests for Qdrant::Api::Collections::Snapshots +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Collections::Snapshots" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Collections::Snapshots.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Collections::Snapshots) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/collections_spec.cr b/samples/client/others/crystal-qdrant/spec/api/collections_spec.cr new file mode 100644 index 000000000000..7cf01e89b926 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/collections_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Collections +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Collections" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Collections.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Collections) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/healthz_spec.cr b/samples/client/others/crystal-qdrant/spec/api/healthz_spec.cr new file mode 100644 index 000000000000..f0f02dd55247 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/healthz_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Healthz +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Healthz" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Healthz.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Healthz) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/issues_spec.cr b/samples/client/others/crystal-qdrant/spec/api/issues_spec.cr new file mode 100644 index 000000000000..2ad29b586d7b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/issues_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Issues +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Issues" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Issues.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Issues) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/livez_spec.cr b/samples/client/others/crystal-qdrant/spec/api/livez_spec.cr new file mode 100644 index 000000000000..5ae527653a0e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/livez_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Livez +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Livez" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Livez.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Livez) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/locks_spec.cr b/samples/client/others/crystal-qdrant/spec/api/locks_spec.cr new file mode 100644 index 000000000000..1ac69316a4fe --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/locks_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Locks +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Locks" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Locks.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Locks) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/metrics_spec.cr b/samples/client/others/crystal-qdrant/spec/api/metrics_spec.cr new file mode 100644 index 000000000000..7bf7c2413679 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/metrics_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Metrics +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Metrics" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Metrics.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Metrics) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/readyz_spec.cr b/samples/client/others/crystal-qdrant/spec/api/readyz_spec.cr new file mode 100644 index 000000000000..e0b038c05373 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/readyz_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Readyz +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Readyz" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Readyz.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Readyz) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/root_spec.cr b/samples/client/others/crystal-qdrant/spec/api/root_spec.cr new file mode 100644 index 000000000000..c012e0f95064 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/root_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Root +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Root" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Root.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Root) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/snapshots_spec.cr b/samples/client/others/crystal-qdrant/spec/api/snapshots_spec.cr new file mode 100644 index 000000000000..0a1c3c6fc5ee --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/snapshots_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Snapshots +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Snapshots" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Snapshots.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Snapshots) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/api/telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/api/telemetry_spec.cr new file mode 100644 index 000000000000..458675c2b9b2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/api/telemetry_spec.cr @@ -0,0 +1,23 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Telemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Telemetry" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Qdrant::Api::Client.new(host: "localhost") + instance = Qdrant::Api::Telemetry.new(client.connection) + expect(instance).to be_a(Qdrant::Api::Telemetry) + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/abort_shard_transfer_spec.cr b/samples/client/others/crystal-qdrant/spec/models/abort_shard_transfer_spec.cr new file mode 100644 index 000000000000..e2756591c45d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/abort_shard_transfer_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AbortShardTransfer +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AbortShardTransfer do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::AbortShardTransfer.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/abort_transfer_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/abort_transfer_operation_spec.cr new file mode 100644 index 000000000000..cb6a8fc732d6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/abort_transfer_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AbortTransferOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AbortTransferOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::AbortTransferOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/alias_description_spec.cr b/samples/client/others/crystal-qdrant/spec/models/alias_description_spec.cr new file mode 100644 index 000000000000..49095fd45e3b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/alias_description_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AliasDescription +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AliasDescription do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::AliasDescription.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/alias_operations_spec.cr b/samples/client/others/crystal-qdrant/spec/models/alias_operations_spec.cr new file mode 100644 index 000000000000..e03c2ff545de --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/alias_operations_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AliasOperations +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AliasOperations do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::AliasOperations.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/any_variants_spec.cr b/samples/client/others/crystal-qdrant/spec/models/any_variants_spec.cr new file mode 100644 index 000000000000..fe98747eb134 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/any_variants_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AnyVariants +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AnyVariants do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::AnyVariants.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/app_build_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/app_build_telemetry_spec.cr new file mode 100644 index 000000000000..d0490a964ff7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/app_build_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AppBuildTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AppBuildTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::AppBuildTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/app_features_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/app_features_telemetry_spec.cr new file mode 100644 index 000000000000..75fad5a65250 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/app_features_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::AppFeaturesTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::AppFeaturesTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::AppFeaturesTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/batch_payloads_inner_spec.cr b/samples/client/others/crystal-qdrant/spec/models/batch_payloads_inner_spec.cr new file mode 100644 index 000000000000..7412a2ed42e4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/batch_payloads_inner_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BatchPayloadsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BatchPayloadsInner do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::BatchPayloadsInner.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/batch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/batch_spec.cr new file mode 100644 index 000000000000..19ff1e42a647 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/batch_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Batch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Batch do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::Batch.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/batch_update200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/batch_update200_response_spec.cr new file mode 100644 index 000000000000..77c78bc78368 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/batch_update200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BatchUpdate200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BatchUpdate200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::BatchUpdate200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::BatchUpdate200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::BatchUpdate200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/batch_vector_struct_spec.cr b/samples/client/others/crystal-qdrant/spec/models/batch_vector_struct_spec.cr new file mode 100644 index 000000000000..e853d979579a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/batch_vector_struct_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BatchVectorStruct +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BatchVectorStruct do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::BatchVectorStruct.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/binary_quantization_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/binary_quantization_config_spec.cr new file mode 100644 index 000000000000..40c5b0758bbe --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/binary_quantization_config_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BinaryQuantizationConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BinaryQuantizationConfig do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::BinaryQuantizationConfig.from_json("{}") + expect(instance).to be_a(Qdrant::Api::BinaryQuantizationConfig) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::BinaryQuantizationConfig.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/binary_quantization_spec.cr b/samples/client/others/crystal-qdrant/spec/models/binary_quantization_spec.cr new file mode 100644 index 000000000000..98c0df36fd15 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/binary_quantization_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BinaryQuantization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BinaryQuantization do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::BinaryQuantization.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/bool_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/bool_index_params_spec.cr new file mode 100644 index 000000000000..fb7d4188da36 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/bool_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BoolIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BoolIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::BoolIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/bool_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/bool_index_type_spec.cr new file mode 100644 index 000000000000..f814f42ad3cd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/bool_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::BoolIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::BoolIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::BoolIndexType.from_json(%("bool")) + expect(value).to be_a(Qdrant::Api::BoolIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/change_aliases_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/change_aliases_operation_spec.cr new file mode 100644 index 000000000000..4db93ab22003 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/change_aliases_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ChangeAliasesOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ChangeAliasesOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ChangeAliasesOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/clear_payload_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/clear_payload_operation_spec.cr new file mode 100644 index 000000000000..45643b6c1c72 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/clear_payload_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClearPayloadOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClearPayloadOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ClearPayloadOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_config_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_config_telemetry_spec.cr new file mode 100644 index 000000000000..a5dd5750cb8b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_config_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterConfigTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterConfigTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ClusterConfigTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_operations_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_operations_spec.cr new file mode 100644 index 000000000000..d45f41d8d6b6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_operations_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterOperations +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterOperations do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ClusterOperations.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_status200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_status200_response_spec.cr new file mode 100644 index 000000000000..a7d55c70ce47 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_status200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterStatus200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterStatus200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ClusterStatus200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ClusterStatus200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ClusterStatus200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_status_one_of1_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_status_one_of1_spec.cr new file mode 100644 index 000000000000..a39075bc679c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_status_one_of1_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterStatusOneOf1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterStatusOneOf1 do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ClusterStatusOneOf1.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_status_one_of_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_status_one_of_spec.cr new file mode 100644 index 000000000000..981b0446dfd4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_status_one_of_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterStatusOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterStatusOneOf do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ClusterStatusOneOf.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_status_spec.cr new file mode 100644 index 000000000000..e8c947a16b25 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_status_spec.cr @@ -0,0 +1,26 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterStatus do + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect(Qdrant::Api::ClusterStatus.openapi_one_of).to_not be_empty + end + end + + describe ".build" do + it "is defined on the oneOf union type" do + expect(Qdrant::Api::ClusterStatus.responds_to?(:build)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_status_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_status_telemetry_spec.cr new file mode 100644 index 000000000000..150cbc8f2dfe --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_status_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterStatusTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterStatusTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ClusterStatusTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/cluster_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/cluster_telemetry_spec.cr new file mode 100644 index 000000000000..d1ff40943f41 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/cluster_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ClusterTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ClusterTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ClusterTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_cluster_info200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_cluster_info200_response_spec.cr new file mode 100644 index 000000000000..5afabd17b8d2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_cluster_info200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionClusterInfo200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionClusterInfo200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CollectionClusterInfo200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CollectionClusterInfo200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CollectionClusterInfo200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_cluster_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_cluster_info_spec.cr new file mode 100644 index 000000000000..c1fe6d065312 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_cluster_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionClusterInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionClusterInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionClusterInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_config_spec.cr new file mode 100644 index 000000000000..7dc266f4f85b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_description_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_description_spec.cr new file mode 100644 index 000000000000..5434903b5a23 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_description_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionDescription +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionDescription do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionDescription.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_existence_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_existence_spec.cr new file mode 100644 index 000000000000..8cb4b22caf69 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_existence_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionExistence +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionExistence do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionExistence.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_exists200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_exists200_response_spec.cr new file mode 100644 index 000000000000..9c7431045c16 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_exists200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionExists200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionExists200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CollectionExists200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CollectionExists200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CollectionExists200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_info_spec.cr new file mode 100644 index 000000000000..05c27c4f8392 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_params_diff_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_params_diff_spec.cr new file mode 100644 index 000000000000..69faceb58604 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_params_diff_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionParamsDiff +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionParamsDiff do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CollectionParamsDiff.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CollectionParamsDiff) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CollectionParamsDiff.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_params_spec.cr new file mode 100644 index 000000000000..494a8891bec2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_params_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionParams do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CollectionParams.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CollectionParams) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CollectionParams.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_status_spec.cr new file mode 100644 index 000000000000..a96c69a10764 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_status_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionStatus do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::CollectionStatus.from_json(%("green")) + expect(value).to be_a(Qdrant::Api::CollectionStatus) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_telemetry_enum_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_telemetry_enum_spec.cr new file mode 100644 index 000000000000..799a1370e5b6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_telemetry_enum_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionTelemetryEnum +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionTelemetryEnum do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::CollectionTelemetryEnum.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collection_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collection_telemetry_spec.cr new file mode 100644 index 000000000000..fd5e0fd14b59 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collection_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collections_aggregated_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collections_aggregated_telemetry_spec.cr new file mode 100644 index 000000000000..48a41a81ebf5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collections_aggregated_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionsAggregatedTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionsAggregatedTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionsAggregatedTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collections_aliases_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collections_aliases_response_spec.cr new file mode 100644 index 000000000000..62270a602eb8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collections_aliases_response_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionsAliasesResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionsAliasesResponse do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionsAliasesResponse.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collections_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collections_response_spec.cr new file mode 100644 index 000000000000..905ee725efdf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collections_response_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionsResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionsResponse do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionsResponse.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/collections_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/collections_telemetry_spec.cr new file mode 100644 index 000000000000..c26526cb97f6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/collections_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CollectionsTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CollectionsTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CollectionsTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/compression_ratio_spec.cr b/samples/client/others/crystal-qdrant/spec/models/compression_ratio_spec.cr new file mode 100644 index 000000000000..d4fb2b801368 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/compression_ratio_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CompressionRatio +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CompressionRatio do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::CompressionRatio.from_json(%("x4")) + expect(value).to be_a(Qdrant::Api::CompressionRatio) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/condition_spec.cr b/samples/client/others/crystal-qdrant/spec/models/condition_spec.cr new file mode 100644 index 000000000000..87fb503874bf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/condition_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Condition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Condition do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::Condition.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/consensus_config_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/consensus_config_telemetry_spec.cr new file mode 100644 index 000000000000..9abf65d01473 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/consensus_config_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ConsensusConfigTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ConsensusConfigTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ConsensusConfigTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of1_spec.cr b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of1_spec.cr new file mode 100644 index 000000000000..16caba725bc5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of1_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ConsensusThreadStatusOneOf1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ConsensusThreadStatusOneOf1 do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ConsensusThreadStatusOneOf1.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of2_spec.cr b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of2_spec.cr new file mode 100644 index 000000000000..36c6b974ef30 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of2_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ConsensusThreadStatusOneOf2 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ConsensusThreadStatusOneOf2 do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ConsensusThreadStatusOneOf2.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of_spec.cr b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of_spec.cr new file mode 100644 index 000000000000..be12319977bb --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_one_of_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ConsensusThreadStatusOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ConsensusThreadStatusOneOf do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ConsensusThreadStatusOneOf.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_spec.cr new file mode 100644 index 000000000000..4c8202fd38b8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/consensus_thread_status_spec.cr @@ -0,0 +1,26 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ConsensusThreadStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ConsensusThreadStatus do + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect(Qdrant::Api::ConsensusThreadStatus.openapi_one_of).to_not be_empty + end + end + + describe ".build" do + it "is defined on the oneOf union type" do + expect(Qdrant::Api::ConsensusThreadStatus.responds_to?(:build)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/context_example_pair_spec.cr b/samples/client/others/crystal-qdrant/spec/models/context_example_pair_spec.cr new file mode 100644 index 000000000000..f3099e138bef --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/context_example_pair_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ContextExamplePair +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ContextExamplePair do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ContextExamplePair.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/context_input_spec.cr b/samples/client/others/crystal-qdrant/spec/models/context_input_spec.cr new file mode 100644 index 000000000000..870382e59a9d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/context_input_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ContextInput +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ContextInput do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ContextInput.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/context_pair_spec.cr b/samples/client/others/crystal-qdrant/spec/models/context_pair_spec.cr new file mode 100644 index 000000000000..e2c9b65d62c7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/context_pair_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ContextPair +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ContextPair do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ContextPair.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/context_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/context_query_spec.cr new file mode 100644 index 000000000000..b9602df273c4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/context_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ContextQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ContextQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ContextQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/count_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/count_points200_response_spec.cr new file mode 100644 index 000000000000..5dd013b139c8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/count_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CountPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CountPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CountPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CountPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CountPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/count_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/count_request_spec.cr new file mode 100644 index 000000000000..29fecc4a1dce --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/count_request_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CountRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CountRequest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CountRequest.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CountRequest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CountRequest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/count_result_spec.cr b/samples/client/others/crystal-qdrant/spec/models/count_result_spec.cr new file mode 100644 index 000000000000..e52290c6c301 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/count_result_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CountResult +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CountResult do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CountResult.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_alias_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_alias_operation_spec.cr new file mode 100644 index 000000000000..ac32163f4d08 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_alias_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateAliasOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateAliasOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CreateAliasOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_alias_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_alias_spec.cr new file mode 100644 index 000000000000..31ec69b8977d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_alias_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateAlias +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateAlias do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CreateAlias.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_collection_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_collection_spec.cr new file mode 100644 index 000000000000..e5c1225c448f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_collection_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateCollection +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateCollection do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CreateCollection.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CreateCollection) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CreateCollection.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_field_index200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_field_index200_response_spec.cr new file mode 100644 index 000000000000..b6ceb027af4c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_field_index200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateFieldIndex200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateFieldIndex200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CreateFieldIndex200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CreateFieldIndex200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CreateFieldIndex200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_field_index_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_field_index_spec.cr new file mode 100644 index 000000000000..38ce64fa5fa8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_field_index_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateFieldIndex +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateFieldIndex do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CreateFieldIndex.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_shard_key200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_shard_key200_response_spec.cr new file mode 100644 index 000000000000..b9ffe06a8d41 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_shard_key200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateShardKey200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateShardKey200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CreateShardKey200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CreateShardKey200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CreateShardKey200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_sharding_key_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_sharding_key_operation_spec.cr new file mode 100644 index 000000000000..d6e1e09b368b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_sharding_key_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateShardingKeyOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateShardingKeyOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CreateShardingKeyOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_sharding_key_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_sharding_key_spec.cr new file mode 100644 index 000000000000..73fdcb123e38 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_sharding_key_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateShardingKey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateShardingKey do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::CreateShardingKey.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/create_snapshot200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/create_snapshot200_response_spec.cr new file mode 100644 index 000000000000..fe6eb225b166 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/create_snapshot200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::CreateSnapshot200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::CreateSnapshot200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::CreateSnapshot200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::CreateSnapshot200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::CreateSnapshot200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/datatype_spec.cr b/samples/client/others/crystal-qdrant/spec/models/datatype_spec.cr new file mode 100644 index 000000000000..2882fb1523d3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/datatype_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Datatype +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Datatype do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Datatype.from_json(%("float32")) + expect(value).to be_a(Qdrant::Api::Datatype) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/datetime_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/datetime_index_params_spec.cr new file mode 100644 index 000000000000..12dbbbd52972 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/datetime_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DatetimeIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DatetimeIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DatetimeIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/datetime_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/datetime_index_type_spec.cr new file mode 100644 index 000000000000..d6fec30aea78 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/datetime_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DatetimeIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DatetimeIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::DatetimeIndexType.from_json(%("datetime")) + expect(value).to be_a(Qdrant::Api::DatetimeIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/datetime_range_spec.cr b/samples/client/others/crystal-qdrant/spec/models/datetime_range_spec.cr new file mode 100644 index 000000000000..a5ae33896123 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/datetime_range_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DatetimeRange +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DatetimeRange do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::DatetimeRange.from_json("{}") + expect(instance).to be_a(Qdrant::Api::DatetimeRange) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::DatetimeRange.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_alias_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_alias_operation_spec.cr new file mode 100644 index 000000000000..acdab9d66203 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_alias_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeleteAliasOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeleteAliasOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeleteAliasOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_alias_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_alias_spec.cr new file mode 100644 index 000000000000..7ec3b93197b9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_alias_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeleteAlias +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeleteAlias do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeleteAlias.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_operation_spec.cr new file mode 100644 index 000000000000..152ff0222e90 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeleteOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeleteOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeleteOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_payload_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_payload_operation_spec.cr new file mode 100644 index 000000000000..cab8deff0ea7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_payload_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeletePayloadOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeletePayloadOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeletePayloadOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_payload_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_payload_spec.cr new file mode 100644 index 000000000000..e347f46845fd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_payload_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeletePayload +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeletePayload do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeletePayload.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_vectors_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_vectors_operation_spec.cr new file mode 100644 index 000000000000..e23d7d6ebec8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_vectors_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeleteVectorsOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeleteVectorsOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeleteVectorsOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/delete_vectors_spec.cr b/samples/client/others/crystal-qdrant/spec/models/delete_vectors_spec.cr new file mode 100644 index 000000000000..3ee266979dfe --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/delete_vectors_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DeleteVectors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DeleteVectors do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DeleteVectors.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/direction_spec.cr b/samples/client/others/crystal-qdrant/spec/models/direction_spec.cr new file mode 100644 index 000000000000..7875c5bf919b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/direction_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Direction +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Direction do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Direction.from_json(%("asc")) + expect(value).to be_a(Qdrant::Api::Direction) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/disabled_spec.cr b/samples/client/others/crystal-qdrant/spec/models/disabled_spec.cr new file mode 100644 index 000000000000..4df841c41c41 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/disabled_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Disabled +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Disabled do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Disabled.from_json(%("Disabled")) + expect(value).to be_a(Qdrant::Api::Disabled) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/discover_input_context_spec.cr b/samples/client/others/crystal-qdrant/spec/models/discover_input_context_spec.cr new file mode 100644 index 000000000000..2ca03a47e9db --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/discover_input_context_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DiscoverInputContext +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DiscoverInputContext do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::DiscoverInputContext.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/discover_input_spec.cr b/samples/client/others/crystal-qdrant/spec/models/discover_input_spec.cr new file mode 100644 index 000000000000..a2a7ea326822 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/discover_input_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DiscoverInput +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DiscoverInput do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DiscoverInput.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/discover_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/discover_query_spec.cr new file mode 100644 index 000000000000..6dabf8854751 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/discover_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DiscoverQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DiscoverQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DiscoverQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/discover_request_batch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/discover_request_batch_spec.cr new file mode 100644 index 000000000000..7c465e8e6386 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/discover_request_batch_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DiscoverRequestBatch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DiscoverRequestBatch do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DiscoverRequestBatch.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/discover_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/discover_request_spec.cr new file mode 100644 index 000000000000..0f84987c765f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/discover_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DiscoverRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DiscoverRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DiscoverRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/distance_spec.cr b/samples/client/others/crystal-qdrant/spec/models/distance_spec.cr new file mode 100644 index 000000000000..0b9771e7bd71 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/distance_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Distance +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Distance do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Distance.from_json(%("Cosine")) + expect(value).to be_a(Qdrant::Api::Distance) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/document_spec.cr b/samples/client/others/crystal-qdrant/spec/models/document_spec.cr new file mode 100644 index 000000000000..80a81d03ed73 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/document_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Document +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Document do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::Document.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/drop_replica_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/drop_replica_operation_spec.cr new file mode 100644 index 000000000000..6725bcbccc5e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/drop_replica_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DropReplicaOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DropReplicaOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DropReplicaOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/drop_sharding_key_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/drop_sharding_key_operation_spec.cr new file mode 100644 index 000000000000..50c61bcdfe98 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/drop_sharding_key_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DropShardingKeyOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DropShardingKeyOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DropShardingKeyOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/drop_sharding_key_spec.cr b/samples/client/others/crystal-qdrant/spec/models/drop_sharding_key_spec.cr new file mode 100644 index 000000000000..3a9f20d341f6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/drop_sharding_key_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::DropShardingKey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::DropShardingKey do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::DropShardingKey.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/error_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/error_response_spec.cr new file mode 100644 index 000000000000..80ee63f10028 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/error_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ErrorResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ErrorResponse do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ErrorResponse.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ErrorResponse) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ErrorResponse.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/error_response_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/error_response_status_spec.cr new file mode 100644 index 000000000000..530a54274ddd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/error_response_status_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ErrorResponseStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ErrorResponseStatus do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ErrorResponseStatus.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ErrorResponseStatus) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ErrorResponseStatus.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/extended_point_id_spec.cr b/samples/client/others/crystal-qdrant/spec/models/extended_point_id_spec.cr new file mode 100644 index 000000000000..2f9fad6e9f73 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/extended_point_id_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ExtendedPointId +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ExtendedPointId do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ExtendedPointId.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/facet200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/facet200_response_spec.cr new file mode 100644 index 000000000000..b2cfa7fd32d3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/facet200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Facet200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Facet200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::Facet200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::Facet200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::Facet200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/facet_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/facet_request_spec.cr new file mode 100644 index 000000000000..1f20211c98b0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/facet_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FacetRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FacetRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FacetRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/facet_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/facet_response_spec.cr new file mode 100644 index 000000000000..f2dd2b93565e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/facet_response_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FacetResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FacetResponse do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FacetResponse.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/facet_value_hit_spec.cr b/samples/client/others/crystal-qdrant/spec/models/facet_value_hit_spec.cr new file mode 100644 index 000000000000..7e1a41e7572d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/facet_value_hit_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FacetValueHit +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FacetValueHit do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FacetValueHit.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/facet_value_spec.cr b/samples/client/others/crystal-qdrant/spec/models/facet_value_spec.cr new file mode 100644 index 000000000000..9a23f28373ea --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/facet_value_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FacetValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FacetValue do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::FacetValue.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/field_condition_spec.cr b/samples/client/others/crystal-qdrant/spec/models/field_condition_spec.cr new file mode 100644 index 000000000000..1ca4300d9d54 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/field_condition_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FieldCondition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FieldCondition do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FieldCondition.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/filter_selector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/filter_selector_spec.cr new file mode 100644 index 000000000000..a26f48623ae9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/filter_selector_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FilterSelector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FilterSelector do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FilterSelector.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/filter_should_spec.cr b/samples/client/others/crystal-qdrant/spec/models/filter_should_spec.cr new file mode 100644 index 000000000000..1f34ca871901 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/filter_should_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FilterShould +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FilterShould do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::FilterShould.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/filter_spec.cr b/samples/client/others/crystal-qdrant/spec/models/filter_spec.cr new file mode 100644 index 000000000000..381aa7742d9d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/filter_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Filter +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Filter do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::Filter.from_json("{}") + expect(instance).to be_a(Qdrant::Api::Filter) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::Filter.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/float_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/float_index_params_spec.cr new file mode 100644 index 000000000000..32d7afb9bf6d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/float_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FloatIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FloatIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FloatIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/float_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/float_index_type_spec.cr new file mode 100644 index 000000000000..e76b87c2867f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/float_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FloatIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FloatIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::FloatIndexType.from_json(%("float")) + expect(value).to be_a(Qdrant::Api::FloatIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/fusion_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/fusion_query_spec.cr new file mode 100644 index 000000000000..da13fd3e4133 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/fusion_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::FusionQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::FusionQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::FusionQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/fusion_spec.cr b/samples/client/others/crystal-qdrant/spec/models/fusion_spec.cr new file mode 100644 index 000000000000..a9651b077077 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/fusion_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Fusion +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Fusion do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Fusion.from_json(%("rrf")) + expect(value).to be_a(Qdrant::Api::Fusion) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_bounding_box_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_bounding_box_spec.cr new file mode 100644 index 000000000000..f344b1fcd5be --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_bounding_box_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoBoundingBox +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoBoundingBox do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GeoBoundingBox.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_index_params_spec.cr new file mode 100644 index 000000000000..e80d65b55d06 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GeoIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_index_type_spec.cr new file mode 100644 index 000000000000..6e6f84503a24 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::GeoIndexType.from_json(%("geo")) + expect(value).to be_a(Qdrant::Api::GeoIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_line_string_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_line_string_spec.cr new file mode 100644 index 000000000000..bc78a26d1b91 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_line_string_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoLineString +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoLineString do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GeoLineString.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_point_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_point_spec.cr new file mode 100644 index 000000000000..0a1381162114 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_point_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoPoint +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoPoint do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GeoPoint.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_polygon_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_polygon_spec.cr new file mode 100644 index 000000000000..478029c044eb --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_polygon_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoPolygon +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoPolygon do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GeoPolygon.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/geo_radius_spec.cr b/samples/client/others/crystal-qdrant/spec/models/geo_radius_spec.cr new file mode 100644 index 000000000000..0ef8d6a59171 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/geo_radius_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GeoRadius +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GeoRadius do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GeoRadius.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/get_collection200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/get_collection200_response_spec.cr new file mode 100644 index 000000000000..3d9c106183aa --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/get_collection200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GetCollection200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GetCollection200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::GetCollection200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::GetCollection200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::GetCollection200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/get_collection_aliases200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/get_collection_aliases200_response_spec.cr new file mode 100644 index 000000000000..b8d79e3fd4a9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/get_collection_aliases200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GetCollectionAliases200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GetCollectionAliases200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::GetCollectionAliases200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::GetCollectionAliases200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::GetCollectionAliases200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/get_collections200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/get_collections200_response_spec.cr new file mode 100644 index 000000000000..2ace204d5c40 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/get_collections200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GetCollections200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GetCollections200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::GetCollections200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::GetCollections200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::GetCollections200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/get_locks200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/get_locks200_response_spec.cr new file mode 100644 index 000000000000..d01e8083051f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/get_locks200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GetLocks200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GetLocks200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::GetLocks200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::GetLocks200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::GetLocks200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/get_point200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/get_point200_response_spec.cr new file mode 100644 index 000000000000..5f97af3c5d45 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/get_point200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GetPoint200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GetPoint200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::GetPoint200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::GetPoint200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::GetPoint200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/get_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/get_points200_response_spec.cr new file mode 100644 index 000000000000..acecb7449269 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/get_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GetPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GetPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::GetPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::GetPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::GetPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/group_id_spec.cr b/samples/client/others/crystal-qdrant/spec/models/group_id_spec.cr new file mode 100644 index 000000000000..c4f9662e4a83 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/group_id_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GroupId +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GroupId do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::GroupId.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/groups_result_spec.cr b/samples/client/others/crystal-qdrant/spec/models/groups_result_spec.cr new file mode 100644 index 000000000000..033863622760 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/groups_result_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GroupsResult +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GroupsResult do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GroupsResult.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/grpc_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/grpc_telemetry_spec.cr new file mode 100644 index 000000000000..02f9041fc72c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/grpc_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::GrpcTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::GrpcTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::GrpcTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/has_id_condition_spec.cr b/samples/client/others/crystal-qdrant/spec/models/has_id_condition_spec.cr new file mode 100644 index 000000000000..ba3b9bc5ce94 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/has_id_condition_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::HasIdCondition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::HasIdCondition do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::HasIdCondition.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/hnsw_config_diff_spec.cr b/samples/client/others/crystal-qdrant/spec/models/hnsw_config_diff_spec.cr new file mode 100644 index 000000000000..a4f3ce493cf6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/hnsw_config_diff_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::HnswConfigDiff +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::HnswConfigDiff do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::HnswConfigDiff.from_json("{}") + expect(instance).to be_a(Qdrant::Api::HnswConfigDiff) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::HnswConfigDiff.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/hnsw_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/hnsw_config_spec.cr new file mode 100644 index 000000000000..67f9702afdfa --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/hnsw_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::HnswConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::HnswConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::HnswConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/indexes_one_of1_spec.cr b/samples/client/others/crystal-qdrant/spec/models/indexes_one_of1_spec.cr new file mode 100644 index 000000000000..8e88e662b41e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/indexes_one_of1_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::IndexesOneOf1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::IndexesOneOf1 do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::IndexesOneOf1.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/indexes_one_of_spec.cr b/samples/client/others/crystal-qdrant/spec/models/indexes_one_of_spec.cr new file mode 100644 index 000000000000..c1903c9a0cb8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/indexes_one_of_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::IndexesOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::IndexesOneOf do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::IndexesOneOf.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/indexes_spec.cr b/samples/client/others/crystal-qdrant/spec/models/indexes_spec.cr new file mode 100644 index 000000000000..390cc0ffb483 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/indexes_spec.cr @@ -0,0 +1,26 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Indexes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Indexes do + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect(Qdrant::Api::Indexes.openapi_one_of).to_not be_empty + end + end + + describe ".build" do + it "is defined on the oneOf union type" do + expect(Qdrant::Api::Indexes.responds_to?(:build)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/init_from_spec.cr b/samples/client/others/crystal-qdrant/spec/models/init_from_spec.cr new file mode 100644 index 000000000000..1e8878171598 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/init_from_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::InitFrom +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::InitFrom do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::InitFrom.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/integer_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/integer_index_params_spec.cr new file mode 100644 index 000000000000..f0e0da6a1e21 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/integer_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::IntegerIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::IntegerIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::IntegerIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/integer_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/integer_index_type_spec.cr new file mode 100644 index 000000000000..3e8b5e2e3adc --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/integer_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::IntegerIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::IntegerIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::IntegerIndexType.from_json(%("integer")) + expect(value).to be_a(Qdrant::Api::IntegerIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/is_empty_condition_spec.cr b/samples/client/others/crystal-qdrant/spec/models/is_empty_condition_spec.cr new file mode 100644 index 000000000000..5386e7eeba68 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/is_empty_condition_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::IsEmptyCondition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::IsEmptyCondition do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::IsEmptyCondition.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/is_null_condition_spec.cr b/samples/client/others/crystal-qdrant/spec/models/is_null_condition_spec.cr new file mode 100644 index 000000000000..ced219302ea4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/is_null_condition_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::IsNullCondition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::IsNullCondition do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::IsNullCondition.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/keyword_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/keyword_index_params_spec.cr new file mode 100644 index 000000000000..d19d88c470e6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/keyword_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::KeywordIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::KeywordIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::KeywordIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/keyword_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/keyword_index_type_spec.cr new file mode 100644 index 000000000000..3820ca5fba05 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/keyword_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::KeywordIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::KeywordIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::KeywordIndexType.from_json(%("keyword")) + expect(value).to be_a(Qdrant::Api::KeywordIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/list_snapshots200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/list_snapshots200_response_spec.cr new file mode 100644 index 000000000000..875381e2a684 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/list_snapshots200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ListSnapshots200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ListSnapshots200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ListSnapshots200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ListSnapshots200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ListSnapshots200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/local_shard_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/local_shard_info_spec.cr new file mode 100644 index 000000000000..a4ac17f5ca48 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/local_shard_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::LocalShardInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::LocalShardInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::LocalShardInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/local_shard_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/local_shard_telemetry_spec.cr new file mode 100644 index 000000000000..7ca64ac46c47 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/local_shard_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::LocalShardTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::LocalShardTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::LocalShardTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/locks_option_spec.cr b/samples/client/others/crystal-qdrant/spec/models/locks_option_spec.cr new file mode 100644 index 000000000000..e25ed084e587 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/locks_option_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::LocksOption +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::LocksOption do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::LocksOption.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/lookup_location_spec.cr b/samples/client/others/crystal-qdrant/spec/models/lookup_location_spec.cr new file mode 100644 index 000000000000..c6309e857d37 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/lookup_location_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::LookupLocation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::LookupLocation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::LookupLocation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/match_any_spec.cr b/samples/client/others/crystal-qdrant/spec/models/match_any_spec.cr new file mode 100644 index 000000000000..0144fbe9a096 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/match_any_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MatchAny +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MatchAny do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MatchAny.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/match_except_spec.cr b/samples/client/others/crystal-qdrant/spec/models/match_except_spec.cr new file mode 100644 index 000000000000..2189c99c44c0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/match_except_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MatchExcept +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MatchExcept do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MatchExcept.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/match_spec.cr b/samples/client/others/crystal-qdrant/spec/models/match_spec.cr new file mode 100644 index 000000000000..59fc871cf85a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/match_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Match +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Match do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::Match.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/match_text_spec.cr b/samples/client/others/crystal-qdrant/spec/models/match_text_spec.cr new file mode 100644 index 000000000000..d82e279a4395 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/match_text_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MatchText +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MatchText do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MatchText.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/match_value_spec.cr b/samples/client/others/crystal-qdrant/spec/models/match_value_spec.cr new file mode 100644 index 000000000000..9025240a5adf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/match_value_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MatchValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MatchValue do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MatchValue.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/message_send_errors_spec.cr b/samples/client/others/crystal-qdrant/spec/models/message_send_errors_spec.cr new file mode 100644 index 000000000000..5cda0df69234 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/message_send_errors_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MessageSendErrors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MessageSendErrors do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MessageSendErrors.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/min_should_spec.cr b/samples/client/others/crystal-qdrant/spec/models/min_should_spec.cr new file mode 100644 index 000000000000..a3488cd2d244 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/min_should_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MinShould +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MinShould do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MinShould.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/modifier_spec.cr b/samples/client/others/crystal-qdrant/spec/models/modifier_spec.cr new file mode 100644 index 000000000000..8cbe130887e8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/modifier_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Modifier +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Modifier do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Modifier.from_json(%("none")) + expect(value).to be_a(Qdrant::Api::Modifier) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/move_shard_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/move_shard_operation_spec.cr new file mode 100644 index 000000000000..3f6a3e435eb9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/move_shard_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MoveShardOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MoveShardOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MoveShardOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/move_shard_spec.cr b/samples/client/others/crystal-qdrant/spec/models/move_shard_spec.cr new file mode 100644 index 000000000000..6972dbf1c731 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/move_shard_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MoveShard +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MoveShard do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MoveShard.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/multi_vector_comparator_spec.cr b/samples/client/others/crystal-qdrant/spec/models/multi_vector_comparator_spec.cr new file mode 100644 index 000000000000..a0c902a43501 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/multi_vector_comparator_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MultiVectorComparator +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MultiVectorComparator do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::MultiVectorComparator.from_json(%("max_sim")) + expect(value).to be_a(Qdrant::Api::MultiVectorComparator) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/multi_vector_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/multi_vector_config_spec.cr new file mode 100644 index 000000000000..396de563d112 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/multi_vector_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::MultiVectorConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::MultiVectorConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::MultiVectorConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/named_sparse_vector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/named_sparse_vector_spec.cr new file mode 100644 index 000000000000..971cd46b0892 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/named_sparse_vector_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::NamedSparseVector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::NamedSparseVector do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::NamedSparseVector.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/named_vector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/named_vector_spec.cr new file mode 100644 index 000000000000..8186bc307464 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/named_vector_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::NamedVector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::NamedVector do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::NamedVector.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/named_vector_struct_spec.cr b/samples/client/others/crystal-qdrant/spec/models/named_vector_struct_spec.cr new file mode 100644 index 000000000000..e45baa77ae45 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/named_vector_struct_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::NamedVectorStruct +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::NamedVectorStruct do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::NamedVectorStruct.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/nearest_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/nearest_query_spec.cr new file mode 100644 index 000000000000..a45f28aaca6b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/nearest_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::NearestQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::NearestQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::NearestQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/nested_condition_spec.cr b/samples/client/others/crystal-qdrant/spec/models/nested_condition_spec.cr new file mode 100644 index 000000000000..c60fb55457b6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/nested_condition_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::NestedCondition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::NestedCondition do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::NestedCondition.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/nested_spec.cr b/samples/client/others/crystal-qdrant/spec/models/nested_spec.cr new file mode 100644 index 000000000000..932ba308a244 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/nested_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Nested +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Nested do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::Nested.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/operation_duration_statistics_spec.cr b/samples/client/others/crystal-qdrant/spec/models/operation_duration_statistics_spec.cr new file mode 100644 index 000000000000..55644d44ff71 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/operation_duration_statistics_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OperationDurationStatistics +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OperationDurationStatistics do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OperationDurationStatistics.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/optimizer_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/optimizer_telemetry_spec.cr new file mode 100644 index 000000000000..bba14887753d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/optimizer_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OptimizerTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OptimizerTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OptimizerTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/optimizers_config_diff_spec.cr b/samples/client/others/crystal-qdrant/spec/models/optimizers_config_diff_spec.cr new file mode 100644 index 000000000000..ae0e332e2271 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/optimizers_config_diff_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OptimizersConfigDiff +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OptimizersConfigDiff do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::OptimizersConfigDiff.from_json("{}") + expect(instance).to be_a(Qdrant::Api::OptimizersConfigDiff) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::OptimizersConfigDiff.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/optimizers_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/optimizers_config_spec.cr new file mode 100644 index 000000000000..da5283f52660 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/optimizers_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OptimizersConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OptimizersConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OptimizersConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/optimizers_status_one_of_spec.cr b/samples/client/others/crystal-qdrant/spec/models/optimizers_status_one_of_spec.cr new file mode 100644 index 000000000000..deb79124d679 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/optimizers_status_one_of_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OptimizersStatusOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OptimizersStatusOneOf do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OptimizersStatusOneOf.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/optimizers_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/optimizers_status_spec.cr new file mode 100644 index 000000000000..e3275afd18d9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/optimizers_status_spec.cr @@ -0,0 +1,26 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OptimizersStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OptimizersStatus do + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect(Qdrant::Api::OptimizersStatus.openapi_one_of).to_not be_empty + end + end + + describe ".build" do + it "is defined on the oneOf union type" do + expect(Qdrant::Api::OptimizersStatus.responds_to?(:build)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/order_by_interface_spec.cr b/samples/client/others/crystal-qdrant/spec/models/order_by_interface_spec.cr new file mode 100644 index 000000000000..b756b2c0c181 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/order_by_interface_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OrderByInterface +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OrderByInterface do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::OrderByInterface.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/order_by_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/order_by_query_spec.cr new file mode 100644 index 000000000000..7d45e58216be --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/order_by_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OrderByQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OrderByQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OrderByQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/order_by_spec.cr b/samples/client/others/crystal-qdrant/spec/models/order_by_spec.cr new file mode 100644 index 000000000000..3901090faa90 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/order_by_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OrderBy +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OrderBy do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OrderBy.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/order_value_spec.cr b/samples/client/others/crystal-qdrant/spec/models/order_value_spec.cr new file mode 100644 index 000000000000..3895970d8616 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/order_value_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OrderValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OrderValue do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::OrderValue.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/overwrite_payload_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/overwrite_payload_operation_spec.cr new file mode 100644 index 000000000000..8dec4e864d99 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/overwrite_payload_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::OverwritePayloadOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::OverwritePayloadOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::OverwritePayloadOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/p2p_config_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/p2p_config_telemetry_spec.cr new file mode 100644 index 000000000000..68d68330cc3f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/p2p_config_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::P2pConfigTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::P2pConfigTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::P2pConfigTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_field_schema_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_field_schema_spec.cr new file mode 100644 index 000000000000..33b3f87b9e69 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_field_schema_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadFieldSchema +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadFieldSchema do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::PayloadFieldSchema.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_field_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_field_spec.cr new file mode 100644 index 000000000000..2c53cb18d653 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_field_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadField +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadField do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadField.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_index_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_index_info_spec.cr new file mode 100644 index 000000000000..d31dc5a743d4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_index_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadIndexInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadIndexInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadIndexInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_index_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_index_telemetry_spec.cr new file mode 100644 index 000000000000..8b2411803efd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_index_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadIndexTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadIndexTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadIndexTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_schema_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_schema_params_spec.cr new file mode 100644 index 000000000000..bd912033d65e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_schema_params_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadSchemaParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadSchemaParams do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::PayloadSchemaParams.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_schema_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_schema_type_spec.cr new file mode 100644 index 000000000000..9cb3e917c7f9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_schema_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadSchemaType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadSchemaType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::PayloadSchemaType.from_json(%("keyword")) + expect(value).to be_a(Qdrant::Api::PayloadSchemaType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_selector_exclude_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_selector_exclude_spec.cr new file mode 100644 index 000000000000..c3b0b0a452a9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_selector_exclude_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadSelectorExclude +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadSelectorExclude do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadSelectorExclude.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_selector_include_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_selector_include_spec.cr new file mode 100644 index 000000000000..1ede95b4f554 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_selector_include_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadSelectorInclude +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadSelectorInclude do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadSelectorInclude.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_selector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_selector_spec.cr new file mode 100644 index 000000000000..71071e7b4562 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_selector_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadSelector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadSelector do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::PayloadSelector.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_one_of1_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_one_of1_spec.cr new file mode 100644 index 000000000000..3c5ebc8ab1d6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_one_of1_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadStorageTypeOneOf1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadStorageTypeOneOf1 do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadStorageTypeOneOf1.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_one_of_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_one_of_spec.cr new file mode 100644 index 000000000000..075a92c45d0b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_one_of_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadStorageTypeOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadStorageTypeOneOf do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PayloadStorageTypeOneOf.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_spec.cr new file mode 100644 index 000000000000..23e7d982d9fb --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/payload_storage_type_spec.cr @@ -0,0 +1,26 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PayloadStorageType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PayloadStorageType do + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect(Qdrant::Api::PayloadStorageType.openapi_one_of).to_not be_empty + end + end + + describe ".build" do + it "is defined on the oneOf union type" do + expect(Qdrant::Api::PayloadStorageType.responds_to?(:build)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/peer_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/peer_info_spec.cr new file mode 100644 index 000000000000..5af84d32173f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/peer_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PeerInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PeerInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PeerInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/point_group_spec.cr b/samples/client/others/crystal-qdrant/spec/models/point_group_spec.cr new file mode 100644 index 000000000000..efdf9a8d7ac4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/point_group_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointGroup +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointGroup do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointGroup.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/point_ids_list_spec.cr b/samples/client/others/crystal-qdrant/spec/models/point_ids_list_spec.cr new file mode 100644 index 000000000000..771739468d20 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/point_ids_list_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointIdsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointIdsList do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointIdsList.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/point_insert_operations_spec.cr b/samples/client/others/crystal-qdrant/spec/models/point_insert_operations_spec.cr new file mode 100644 index 000000000000..640b0355dfbc --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/point_insert_operations_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointInsertOperations +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointInsertOperations do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::PointInsertOperations.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/point_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/point_request_spec.cr new file mode 100644 index 000000000000..dd23dea8c645 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/point_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/point_struct_spec.cr b/samples/client/others/crystal-qdrant/spec/models/point_struct_spec.cr new file mode 100644 index 000000000000..dc79acfebdcd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/point_struct_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointStruct +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointStruct do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointStruct.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/point_vectors_spec.cr b/samples/client/others/crystal-qdrant/spec/models/point_vectors_spec.cr new file mode 100644 index 000000000000..b1f104a9acb3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/point_vectors_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointVectors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointVectors do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointVectors.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/points_batch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/points_batch_spec.cr new file mode 100644 index 000000000000..0559eb120c3a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/points_batch_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointsBatch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointsBatch do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointsBatch.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/points_list_spec.cr b/samples/client/others/crystal-qdrant/spec/models/points_list_spec.cr new file mode 100644 index 000000000000..a2b07bbb41a2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/points_list_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointsList +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointsList do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::PointsList.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/points_selector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/points_selector_spec.cr new file mode 100644 index 000000000000..e50ab6e4a13c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/points_selector_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::PointsSelector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::PointsSelector do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::PointsSelector.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/prefetch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/prefetch_spec.cr new file mode 100644 index 000000000000..23c640cb1bed --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/prefetch_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Prefetch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Prefetch do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::Prefetch.from_json("{}") + expect(instance).to be_a(Qdrant::Api::Prefetch) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::Prefetch.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/product_quantization_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/product_quantization_config_spec.cr new file mode 100644 index 000000000000..ffebdc951ff9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/product_quantization_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ProductQuantizationConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ProductQuantizationConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ProductQuantizationConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/product_quantization_spec.cr b/samples/client/others/crystal-qdrant/spec/models/product_quantization_spec.cr new file mode 100644 index 000000000000..ba3670df2e1b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/product_quantization_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ProductQuantization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ProductQuantization do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ProductQuantization.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/quantization_config_diff_spec.cr b/samples/client/others/crystal-qdrant/spec/models/quantization_config_diff_spec.cr new file mode 100644 index 000000000000..bd7d6edc56f0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/quantization_config_diff_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QuantizationConfigDiff +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QuantizationConfigDiff do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::QuantizationConfigDiff.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/quantization_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/quantization_config_spec.cr new file mode 100644 index 000000000000..04e258d3238e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/quantization_config_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QuantizationConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QuantizationConfig do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::QuantizationConfig.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/quantization_search_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/quantization_search_params_spec.cr new file mode 100644 index 000000000000..08b0b72d90ab --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/quantization_search_params_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QuantizationSearchParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QuantizationSearchParams do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::QuantizationSearchParams.from_json("{}") + expect(instance).to be_a(Qdrant::Api::QuantizationSearchParams) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::QuantizationSearchParams.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_batch_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_batch_points200_response_spec.cr new file mode 100644 index 000000000000..13425ecf33cf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_batch_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryBatchPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryBatchPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::QueryBatchPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::QueryBatchPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::QueryBatchPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_groups_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_groups_request_spec.cr new file mode 100644 index 000000000000..a80f8eccf77d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_groups_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryGroupsRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryGroupsRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::QueryGroupsRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_interface_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_interface_spec.cr new file mode 100644 index 000000000000..9e8984e17b21 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_interface_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryInterface +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryInterface do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::QueryInterface.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_points200_response_spec.cr new file mode 100644 index 000000000000..2897a33c3bec --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::QueryPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::QueryPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::QueryPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_request_batch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_request_batch_spec.cr new file mode 100644 index 000000000000..1b4f8babea06 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_request_batch_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryRequestBatch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryRequestBatch do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::QueryRequestBatch.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_request_prefetch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_request_prefetch_spec.cr new file mode 100644 index 000000000000..e10dca325a85 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_request_prefetch_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryRequestPrefetch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryRequestPrefetch do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::QueryRequestPrefetch.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_request_spec.cr new file mode 100644 index 000000000000..b7c6bbbdbda9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_request_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryRequest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::QueryRequest.from_json("{}") + expect(instance).to be_a(Qdrant::Api::QueryRequest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::QueryRequest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_response_spec.cr new file mode 100644 index 000000000000..14e3a1195304 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_response_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::QueryResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::QueryResponse do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::QueryResponse.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/query_spec.cr new file mode 100644 index 000000000000..1dbdd71398e8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/query_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Query +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Query do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::Query.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/raft_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/raft_info_spec.cr new file mode 100644 index 000000000000..2621e904b966 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/raft_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RaftInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RaftInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RaftInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/range_interface_spec.cr b/samples/client/others/crystal-qdrant/spec/models/range_interface_spec.cr new file mode 100644 index 000000000000..fb47d61d8db0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/range_interface_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RangeInterface +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RangeInterface do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::RangeInterface.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/range_spec.cr b/samples/client/others/crystal-qdrant/spec/models/range_spec.cr new file mode 100644 index 000000000000..94c6ba3e014a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/range_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Range +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Range do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::Range.from_json("{}") + expect(instance).to be_a(Qdrant::Api::Range) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::Range.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/read_consistency_spec.cr b/samples/client/others/crystal-qdrant/spec/models/read_consistency_spec.cr new file mode 100644 index 000000000000..53c445227caa --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/read_consistency_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReadConsistency +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReadConsistency do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ReadConsistency.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/read_consistency_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/read_consistency_type_spec.cr new file mode 100644 index 000000000000..f419fcf8ba79 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/read_consistency_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReadConsistencyType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReadConsistencyType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ReadConsistencyType.from_json(%("majority")) + expect(value).to be_a(Qdrant::Api::ReadConsistencyType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_example_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_example_spec.cr new file mode 100644 index 000000000000..f7a27563da45 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_example_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendExample +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendExample do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::RecommendExample.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_groups_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_groups_request_spec.cr new file mode 100644 index 000000000000..9f970a4e2a0b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_groups_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendGroupsRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendGroupsRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RecommendGroupsRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_input_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_input_spec.cr new file mode 100644 index 000000000000..170759843e24 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_input_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendInput +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendInput do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::RecommendInput.from_json("{}") + expect(instance).to be_a(Qdrant::Api::RecommendInput) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::RecommendInput.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_query_spec.cr new file mode 100644 index 000000000000..f5b8fe3b2c70 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RecommendQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_request_batch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_request_batch_spec.cr new file mode 100644 index 000000000000..da3109bcf3cf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_request_batch_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendRequestBatch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendRequestBatch do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RecommendRequestBatch.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_request_spec.cr new file mode 100644 index 000000000000..a745008aeb6c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RecommendRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recommend_strategy_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recommend_strategy_spec.cr new file mode 100644 index 000000000000..4126c0a9ef4e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recommend_strategy_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecommendStrategy +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecommendStrategy do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::RecommendStrategy.from_json(%("average_vector")) + expect(value).to be_a(Qdrant::Api::RecommendStrategy) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/record_spec.cr b/samples/client/others/crystal-qdrant/spec/models/record_spec.cr new file mode 100644 index 000000000000..3ed0aa58255a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/record_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Record +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Record do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::Record.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.cr new file mode 100644 index 000000000000..74bfcd98993f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/recover_from_uploaded_snapshot202_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RecoverFromUploadedSnapshot202Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RecoverFromUploadedSnapshot202Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::RecoverFromUploadedSnapshot202Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::RecoverFromUploadedSnapshot202Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::RecoverFromUploadedSnapshot202Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/remote_shard_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/remote_shard_info_spec.cr new file mode 100644 index 000000000000..82d6c3c415b2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/remote_shard_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RemoteShardInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RemoteShardInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RemoteShardInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/remote_shard_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/remote_shard_telemetry_spec.cr new file mode 100644 index 000000000000..52bbf5f32531 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/remote_shard_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RemoteShardTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RemoteShardTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RemoteShardTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/rename_alias_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/rename_alias_operation_spec.cr new file mode 100644 index 000000000000..5139524b71c7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/rename_alias_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RenameAliasOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RenameAliasOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RenameAliasOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/rename_alias_spec.cr b/samples/client/others/crystal-qdrant/spec/models/rename_alias_spec.cr new file mode 100644 index 000000000000..a9bd6a0639ab --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/rename_alias_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RenameAlias +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RenameAlias do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RenameAlias.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/replica_set_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/replica_set_telemetry_spec.cr new file mode 100644 index 000000000000..979f81eeb40c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/replica_set_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReplicaSetTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReplicaSetTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ReplicaSetTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/replica_spec.cr b/samples/client/others/crystal-qdrant/spec/models/replica_spec.cr new file mode 100644 index 000000000000..6795512d9f76 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/replica_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Replica +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Replica do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::Replica.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/replica_state_spec.cr b/samples/client/others/crystal-qdrant/spec/models/replica_state_spec.cr new file mode 100644 index 000000000000..beba33603ff8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/replica_state_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReplicaState +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReplicaState do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ReplicaState.from_json(%("Active")) + expect(value).to be_a(Qdrant::Api::ReplicaState) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/replicate_shard_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/replicate_shard_operation_spec.cr new file mode 100644 index 000000000000..623a9b26e1f7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/replicate_shard_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReplicateShardOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReplicateShardOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ReplicateShardOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/replicate_shard_spec.cr b/samples/client/others/crystal-qdrant/spec/models/replicate_shard_spec.cr new file mode 100644 index 000000000000..c851e8161e63 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/replicate_shard_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReplicateShard +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReplicateShard do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ReplicateShard.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/requests_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/requests_telemetry_spec.cr new file mode 100644 index 000000000000..5adea3c47c07 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/requests_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RequestsTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RequestsTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RequestsTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/resharding_direction_spec.cr b/samples/client/others/crystal-qdrant/spec/models/resharding_direction_spec.cr new file mode 100644 index 000000000000..be9fd59d2187 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/resharding_direction_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReshardingDirection +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReshardingDirection do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ReshardingDirection.from_json(%("up")) + expect(value).to be_a(Qdrant::Api::ReshardingDirection) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/resharding_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/resharding_info_spec.cr new file mode 100644 index 000000000000..233ad5df1fce --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/resharding_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ReshardingInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ReshardingInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ReshardingInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/restart_transfer_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/restart_transfer_operation_spec.cr new file mode 100644 index 000000000000..5e17f2058a1a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/restart_transfer_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RestartTransferOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RestartTransferOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RestartTransferOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/restart_transfer_spec.cr b/samples/client/others/crystal-qdrant/spec/models/restart_transfer_spec.cr new file mode 100644 index 000000000000..85bb5ebc4925 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/restart_transfer_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RestartTransfer +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RestartTransfer do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RestartTransfer.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/running_environment_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/running_environment_telemetry_spec.cr new file mode 100644 index 000000000000..49be0988915b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/running_environment_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::RunningEnvironmentTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::RunningEnvironmentTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::RunningEnvironmentTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sample_query_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sample_query_spec.cr new file mode 100644 index 000000000000..a133eabf4405 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sample_query_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SampleQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SampleQuery do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SampleQuery.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sample_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sample_spec.cr new file mode 100644 index 000000000000..eb4e649975bf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sample_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Sample +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Sample do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::Sample.from_json(%("random")) + expect(value).to be_a(Qdrant::Api::Sample) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scalar_quantization_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scalar_quantization_config_spec.cr new file mode 100644 index 000000000000..71470eda95b3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scalar_quantization_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScalarQuantizationConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScalarQuantizationConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ScalarQuantizationConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scalar_quantization_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scalar_quantization_spec.cr new file mode 100644 index 000000000000..52fa8632ff25 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scalar_quantization_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScalarQuantization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScalarQuantization do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ScalarQuantization.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scalar_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scalar_type_spec.cr new file mode 100644 index 000000000000..f76fa6df1a4e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scalar_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScalarType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScalarType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ScalarType.from_json(%("int8")) + expect(value).to be_a(Qdrant::Api::ScalarType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scored_point_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scored_point_spec.cr new file mode 100644 index 000000000000..eae18d52de8d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scored_point_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScoredPoint +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScoredPoint do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ScoredPoint.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scroll_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scroll_points200_response_spec.cr new file mode 100644 index 000000000000..39f547945cbc --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scroll_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScrollPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScrollPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ScrollPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ScrollPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ScrollPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scroll_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scroll_request_spec.cr new file mode 100644 index 000000000000..f69bbbc40a0d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scroll_request_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScrollRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScrollRequest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ScrollRequest.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ScrollRequest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ScrollRequest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/scroll_result_spec.cr b/samples/client/others/crystal-qdrant/spec/models/scroll_result_spec.cr new file mode 100644 index 000000000000..aa9a8bdf9718 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/scroll_result_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ScrollResult +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ScrollResult do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ScrollResult.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_batch_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_batch_points200_response_spec.cr new file mode 100644 index 000000000000..fc24ed93b9fd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_batch_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchBatchPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchBatchPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchBatchPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchBatchPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchBatchPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_groups_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_groups_request_spec.cr new file mode 100644 index 000000000000..1a265c68ec6f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_groups_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchGroupsRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchGroupsRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SearchGroupsRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_matrix_offsets200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_matrix_offsets200_response_spec.cr new file mode 100644 index 000000000000..ddeeffe10065 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_matrix_offsets200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchMatrixOffsets200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchMatrixOffsets200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchMatrixOffsets200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchMatrixOffsets200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchMatrixOffsets200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_matrix_offsets_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_matrix_offsets_response_spec.cr new file mode 100644 index 000000000000..ebf9a1617a8e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_matrix_offsets_response_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchMatrixOffsetsResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchMatrixOffsetsResponse do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SearchMatrixOffsetsResponse.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_matrix_pair_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_matrix_pair_spec.cr new file mode 100644 index 000000000000..8fc9893adb22 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_matrix_pair_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchMatrixPair +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchMatrixPair do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SearchMatrixPair.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_matrix_pairs200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_matrix_pairs200_response_spec.cr new file mode 100644 index 000000000000..a93e54495fe0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_matrix_pairs200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchMatrixPairs200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchMatrixPairs200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchMatrixPairs200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchMatrixPairs200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchMatrixPairs200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_matrix_pairs_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_matrix_pairs_response_spec.cr new file mode 100644 index 000000000000..aa5da9a5d3a1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_matrix_pairs_response_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchMatrixPairsResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchMatrixPairsResponse do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SearchMatrixPairsResponse.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_matrix_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_matrix_request_spec.cr new file mode 100644 index 000000000000..8c8f15b311d6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_matrix_request_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchMatrixRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchMatrixRequest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchMatrixRequest.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchMatrixRequest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchMatrixRequest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_params_spec.cr new file mode 100644 index 000000000000..740087bcea45 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_params_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchParams do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchParams.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchParams) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchParams.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_point_groups200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_point_groups200_response_spec.cr new file mode 100644 index 000000000000..d83cb754e847 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_point_groups200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchPointGroups200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchPointGroups200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchPointGroups200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchPointGroups200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchPointGroups200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_points200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_points200_response_spec.cr new file mode 100644 index 000000000000..5a075c619384 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_points200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchPoints200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchPoints200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SearchPoints200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SearchPoints200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SearchPoints200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_request_batch_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_request_batch_spec.cr new file mode 100644 index 000000000000..dee2d66c7966 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_request_batch_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchRequestBatch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchRequestBatch do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SearchRequestBatch.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/search_request_spec.cr b/samples/client/others/crystal-qdrant/spec/models/search_request_spec.cr new file mode 100644 index 000000000000..1ebde8ab2c23 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/search_request_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SearchRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SearchRequest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SearchRequest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/segment_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/segment_config_spec.cr new file mode 100644 index 000000000000..970e990a7c58 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/segment_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SegmentConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SegmentConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SegmentConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/segment_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/segment_info_spec.cr new file mode 100644 index 000000000000..05efca83a7a2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/segment_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SegmentInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SegmentInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SegmentInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/segment_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/segment_telemetry_spec.cr new file mode 100644 index 000000000000..1d778204e84c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/segment_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SegmentTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SegmentTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SegmentTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/segment_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/segment_type_spec.cr new file mode 100644 index 000000000000..51f6593fa5f9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/segment_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SegmentType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SegmentType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::SegmentType.from_json(%("plain")) + expect(value).to be_a(Qdrant::Api::SegmentType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/set_payload_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/set_payload_operation_spec.cr new file mode 100644 index 000000000000..0ee9b2dfb000 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/set_payload_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SetPayloadOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SetPayloadOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SetPayloadOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/set_payload_spec.cr b/samples/client/others/crystal-qdrant/spec/models/set_payload_spec.cr new file mode 100644 index 000000000000..1b23bd8fb989 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/set_payload_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SetPayload +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SetPayload do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SetPayload.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_key_selector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_key_selector_spec.cr new file mode 100644 index 000000000000..9141288aeab0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_key_selector_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardKeySelector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardKeySelector do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ShardKeySelector.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_key_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_key_spec.cr new file mode 100644 index 000000000000..ea7e46595033 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_key_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardKey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardKey do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ShardKey.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_snapshot_location_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_snapshot_location_spec.cr new file mode 100644 index 000000000000..940b7ecd7a63 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_snapshot_location_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardSnapshotLocation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardSnapshotLocation do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ShardSnapshotLocation.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_snapshot_recover_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_snapshot_recover_spec.cr new file mode 100644 index 000000000000..bc6c58386635 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_snapshot_recover_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardSnapshotRecover +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardSnapshotRecover do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ShardSnapshotRecover.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_status_spec.cr new file mode 100644 index 000000000000..1fb2b2d9e10d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_status_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardStatus do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ShardStatus.from_json(%("green")) + expect(value).to be_a(Qdrant::Api::ShardStatus) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_transfer_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_transfer_info_spec.cr new file mode 100644 index 000000000000..d2ac63b25c00 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_transfer_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardTransferInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardTransferInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::ShardTransferInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/shard_transfer_method_spec.cr b/samples/client/others/crystal-qdrant/spec/models/shard_transfer_method_spec.cr new file mode 100644 index 000000000000..9fd1e2e66598 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/shard_transfer_method_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardTransferMethod +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardTransferMethod do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ShardTransferMethod.from_json(%("stream_records")) + expect(value).to be_a(Qdrant::Api::ShardTransferMethod) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sharding_method_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sharding_method_spec.cr new file mode 100644 index 000000000000..33ab4e844904 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sharding_method_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ShardingMethod +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ShardingMethod do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::ShardingMethod.from_json(%("auto")) + expect(value).to be_a(Qdrant::Api::ShardingMethod) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/snapshot_description_spec.cr b/samples/client/others/crystal-qdrant/spec/models/snapshot_description_spec.cr new file mode 100644 index 000000000000..194374427ec5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/snapshot_description_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SnapshotDescription +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SnapshotDescription do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SnapshotDescription.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/snapshot_priority_spec.cr b/samples/client/others/crystal-qdrant/spec/models/snapshot_priority_spec.cr new file mode 100644 index 000000000000..5c512052a5f0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/snapshot_priority_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SnapshotPriority +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SnapshotPriority do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::SnapshotPriority.from_json(%("no_sync")) + expect(value).to be_a(Qdrant::Api::SnapshotPriority) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/snapshot_recover_spec.cr b/samples/client/others/crystal-qdrant/spec/models/snapshot_recover_spec.cr new file mode 100644 index 000000000000..53937e06c32b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/snapshot_recover_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SnapshotRecover +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SnapshotRecover do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SnapshotRecover.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sparse_index_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sparse_index_config_spec.cr new file mode 100644 index 000000000000..576ab020d451 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sparse_index_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SparseIndexConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SparseIndexConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SparseIndexConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sparse_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sparse_index_params_spec.cr new file mode 100644 index 000000000000..20bcdbf1946d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sparse_index_params_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SparseIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SparseIndexParams do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SparseIndexParams.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SparseIndexParams) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SparseIndexParams.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sparse_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sparse_index_type_spec.cr new file mode 100644 index 000000000000..aebd42065770 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sparse_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SparseIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SparseIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::SparseIndexType.from_json(%("MutableRam")) + expect(value).to be_a(Qdrant::Api::SparseIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sparse_vector_data_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sparse_vector_data_config_spec.cr new file mode 100644 index 000000000000..7ca92cc5cc5f --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sparse_vector_data_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SparseVectorDataConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SparseVectorDataConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SparseVectorDataConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sparse_vector_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sparse_vector_params_spec.cr new file mode 100644 index 000000000000..711e30ae18a8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sparse_vector_params_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SparseVectorParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SparseVectorParams do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::SparseVectorParams.from_json("{}") + expect(instance).to be_a(Qdrant::Api::SparseVectorParams) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::SparseVectorParams.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/sparse_vector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/sparse_vector_spec.cr new file mode 100644 index 000000000000..8230a8c8ed39 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/sparse_vector_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::SparseVector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::SparseVector do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::SparseVector.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/start_from_spec.cr b/samples/client/others/crystal-qdrant/spec/models/start_from_spec.cr new file mode 100644 index 000000000000..e4f26760ce58 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/start_from_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::StartFrom +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::StartFrom do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::StartFrom.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/state_role_spec.cr b/samples/client/others/crystal-qdrant/spec/models/state_role_spec.cr new file mode 100644 index 000000000000..c8c4e506deac --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/state_role_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::StateRole +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::StateRole do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::StateRole.from_json(%("Follower")) + expect(value).to be_a(Qdrant::Api::StateRole) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/telemetry200_response_spec.cr b/samples/client/others/crystal-qdrant/spec/models/telemetry200_response_spec.cr new file mode 100644 index 000000000000..a5a7710b497b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/telemetry200_response_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Telemetry200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Telemetry200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::Telemetry200Response.from_json("{}") + expect(instance).to be_a(Qdrant::Api::Telemetry200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::Telemetry200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/telemetry_data_spec.cr b/samples/client/others/crystal-qdrant/spec/models/telemetry_data_spec.cr new file mode 100644 index 000000000000..efaaaf034469 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/telemetry_data_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TelemetryData +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TelemetryData do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::TelemetryData.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/text_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/text_index_params_spec.cr new file mode 100644 index 000000000000..356f81310ebf --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/text_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TextIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TextIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::TextIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/text_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/text_index_type_spec.cr new file mode 100644 index 000000000000..154e2aaf24db --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/text_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TextIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TextIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::TextIndexType.from_json(%("text")) + expect(value).to be_a(Qdrant::Api::TextIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/tokenizer_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/tokenizer_type_spec.cr new file mode 100644 index 000000000000..9a8fe7637868 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/tokenizer_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TokenizerType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TokenizerType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::TokenizerType.from_json(%("prefix")) + expect(value).to be_a(Qdrant::Api::TokenizerType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/tracker_status_one_of_spec.cr b/samples/client/others/crystal-qdrant/spec/models/tracker_status_one_of_spec.cr new file mode 100644 index 000000000000..5e5c04511bae --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/tracker_status_one_of_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TrackerStatusOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TrackerStatusOneOf do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::TrackerStatusOneOf.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/tracker_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/tracker_status_spec.cr new file mode 100644 index 000000000000..3e69e2962325 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/tracker_status_spec.cr @@ -0,0 +1,26 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TrackerStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TrackerStatus do + describe ".openapi_one_of" do + it "lists the items referenced in the oneOf array" do + expect(Qdrant::Api::TrackerStatus.openapi_one_of).to_not be_empty + end + end + + describe ".build" do + it "is defined on the oneOf union type" do + expect(Qdrant::Api::TrackerStatus.responds_to?(:build)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/tracker_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/tracker_telemetry_spec.cr new file mode 100644 index 000000000000..f1a2e64e0b50 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/tracker_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::TrackerTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::TrackerTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::TrackerTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_collection_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_collection_spec.cr new file mode 100644 index 000000000000..2f4aa031d2f2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_collection_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateCollection +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateCollection do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::UpdateCollection.from_json("{}") + expect(instance).to be_a(Qdrant::Api::UpdateCollection) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::UpdateCollection.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_operation_spec.cr new file mode 100644 index 000000000000..765226002f91 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_operation_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateOperation do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::UpdateOperation.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_operations_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_operations_spec.cr new file mode 100644 index 000000000000..e59a01308afc --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_operations_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateOperations +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateOperations do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::UpdateOperations.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_result_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_result_spec.cr new file mode 100644 index 000000000000..27e1949994cd --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_result_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateResult +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateResult do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::UpdateResult.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_status_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_status_spec.cr new file mode 100644 index 000000000000..ab1c749de7da --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_status_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateStatus do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::UpdateStatus.from_json(%("acknowledged")) + expect(value).to be_a(Qdrant::Api::UpdateStatus) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_vectors_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_vectors_operation_spec.cr new file mode 100644 index 000000000000..a91b96e9ec57 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_vectors_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateVectorsOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateVectorsOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::UpdateVectorsOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/update_vectors_spec.cr b/samples/client/others/crystal-qdrant/spec/models/update_vectors_spec.cr new file mode 100644 index 000000000000..999ffd1750d1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/update_vectors_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpdateVectors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpdateVectors do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::UpdateVectors.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/upsert_operation_spec.cr b/samples/client/others/crystal-qdrant/spec/models/upsert_operation_spec.cr new file mode 100644 index 000000000000..014238416494 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/upsert_operation_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UpsertOperation +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UpsertOperation do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::UpsertOperation.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/uuid_index_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/uuid_index_params_spec.cr new file mode 100644 index 000000000000..04e8349597d7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/uuid_index_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UuidIndexParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UuidIndexParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::UuidIndexParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/uuid_index_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/uuid_index_type_spec.cr new file mode 100644 index 000000000000..48d125e166b1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/uuid_index_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::UuidIndexType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::UuidIndexType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::UuidIndexType.from_json(%("uuid")) + expect(value).to be_a(Qdrant::Api::UuidIndexType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/value_variants_spec.cr b/samples/client/others/crystal-qdrant/spec/models/value_variants_spec.cr new file mode 100644 index 000000000000..2cfdd203bb92 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/value_variants_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ValueVariants +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ValueVariants do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::ValueVariants.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/values_count_spec.cr b/samples/client/others/crystal-qdrant/spec/models/values_count_spec.cr new file mode 100644 index 000000000000..35209f309d1e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/values_count_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::ValuesCount +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::ValuesCount do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::ValuesCount.from_json("{}") + expect(instance).to be_a(Qdrant::Api::ValuesCount) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::ValuesCount.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_data_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_data_config_spec.cr new file mode 100644 index 000000000000..5c00b00fcb2b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_data_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorDataConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorDataConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::VectorDataConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_data_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_data_info_spec.cr new file mode 100644 index 000000000000..31c446d29ba5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_data_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorDataInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorDataInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::VectorDataInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_index_searches_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_index_searches_telemetry_spec.cr new file mode 100644 index 000000000000..758620dd629d --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_index_searches_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorIndexSearchesTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorIndexSearchesTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::VectorIndexSearchesTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_input_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_input_spec.cr new file mode 100644 index 000000000000..7ca907d0ce7e --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_input_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorInput +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorInput do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::VectorInput.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_params_diff_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_params_diff_spec.cr new file mode 100644 index 000000000000..5e83404283a9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_params_diff_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorParamsDiff +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorParamsDiff do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::VectorParamsDiff.from_json("{}") + expect(instance).to be_a(Qdrant::Api::VectorParamsDiff) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::VectorParamsDiff.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_params_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_params_spec.cr new file mode 100644 index 000000000000..d7e74130e748 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_params_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorParams +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorParams do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::VectorParams.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_spec.cr new file mode 100644 index 000000000000..19e46f2b9da2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::Vector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::Vector do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::Vector.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_storage_datatype_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_storage_datatype_spec.cr new file mode 100644 index 000000000000..57e4e9ab6112 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_storage_datatype_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorStorageDatatype +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorStorageDatatype do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::VectorStorageDatatype.from_json(%("float32")) + expect(value).to be_a(Qdrant::Api::VectorStorageDatatype) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_storage_type_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_storage_type_spec.cr new file mode 100644 index 000000000000..9278047973d9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_storage_type_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorStorageType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorStorageType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::VectorStorageType.from_json(%("Memory")) + expect(value).to be_a(Qdrant::Api::VectorStorageType) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vector_struct_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vector_struct_spec.cr new file mode 100644 index 000000000000..c117227fd579 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vector_struct_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorStruct +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorStruct do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::VectorStruct.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/vectors_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/vectors_config_spec.cr new file mode 100644 index 000000000000..1c1db19e766c --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/vectors_config_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VectorsConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VectorsConfig do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::VectorsConfig.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/version_info_spec.cr b/samples/client/others/crystal-qdrant/spec/models/version_info_spec.cr new file mode 100644 index 000000000000..938b9131bf2a --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/version_info_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::VersionInfo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::VersionInfo do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::VersionInfo.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/wal_config_diff_spec.cr b/samples/client/others/crystal-qdrant/spec/models/wal_config_diff_spec.cr new file mode 100644 index 000000000000..354a50d8eed4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/wal_config_diff_spec.cr @@ -0,0 +1,29 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WalConfigDiff +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WalConfigDiff do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Qdrant::Api::WalConfigDiff.from_json("{}") + expect(instance).to be_a(Qdrant::Api::WalConfigDiff) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Qdrant::Api::WalConfigDiff.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/wal_config_spec.cr b/samples/client/others/crystal-qdrant/spec/models/wal_config_spec.cr new file mode 100644 index 000000000000..6901f3f9742b --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/wal_config_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WalConfig +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WalConfig do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::WalConfig.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/web_api_telemetry_spec.cr b/samples/client/others/crystal-qdrant/spec/models/web_api_telemetry_spec.cr new file mode 100644 index 000000000000..997615742563 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/web_api_telemetry_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WebApiTelemetry +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WebApiTelemetry do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::WebApiTelemetry.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/with_lookup_interface_spec.cr b/samples/client/others/crystal-qdrant/spec/models/with_lookup_interface_spec.cr new file mode 100644 index 000000000000..05eaf38e77f6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/with_lookup_interface_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WithLookupInterface +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WithLookupInterface do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::WithLookupInterface.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/with_lookup_spec.cr b/samples/client/others/crystal-qdrant/spec/models/with_lookup_spec.cr new file mode 100644 index 000000000000..9f6e4c4df991 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/with_lookup_spec.cr @@ -0,0 +1,24 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WithLookup +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WithLookup do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Qdrant::Api::WithLookup.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/with_payload_interface_spec.cr b/samples/client/others/crystal-qdrant/spec/models/with_payload_interface_spec.cr new file mode 100644 index 000000000000..a6a418c2fd12 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/with_payload_interface_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WithPayloadInterface +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WithPayloadInterface do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::WithPayloadInterface.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/with_vector_spec.cr b/samples/client/others/crystal-qdrant/spec/models/with_vector_spec.cr new file mode 100644 index 000000000000..2017b238b9d9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/with_vector_spec.cr @@ -0,0 +1,20 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WithVector +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WithVector do + describe "union (anyOf)" do + it "is (de)serialisable as a union alias" do + expect(Qdrant::Api::WithVector.responds_to?(:from_json)).to be_true + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/models/write_ordering_spec.cr b/samples/client/others/crystal-qdrant/spec/models/write_ordering_spec.cr new file mode 100644 index 000000000000..871f41bcdfaa --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/models/write_ordering_spec.cr @@ -0,0 +1,21 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Qdrant::Api::WriteOrdering +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Qdrant::Api::WriteOrdering do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Qdrant::Api::WriteOrdering.from_json(%("weak")) + expect(value).to be_a(Qdrant::Api::WriteOrdering) + end + end +end diff --git a/samples/client/others/crystal-qdrant/spec/spec_helper.cr b/samples/client/others/crystal-qdrant/spec/spec_helper.cr new file mode 100644 index 000000000000..d93d154715fa --- /dev/null +++ b/samples/client/others/crystal-qdrant/spec/spec_helper.cr @@ -0,0 +1,11 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +# load modules +require "spectator" +require "../src/qdrant-api" diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api.cr b/samples/client/others/crystal-qdrant/src/qdrant-api.cr new file mode 100644 index 000000000000..a8f474f6a186 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api.cr @@ -0,0 +1,364 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# +require "big" +require "big/json" +require "json" +require "log" +require "time" +require "uri" +require "yaml" + +require "./qdrant-api/configuration" +require "./qdrant-api/connection" +require "./qdrant-api/response" +require "./qdrant-api/api_error" +require "./qdrant-api/client" +require "./qdrant-api/serializable" +require "./qdrant-api/validation" + +# Models +require "./qdrant-api/models/abort_shard_transfer" +require "./qdrant-api/models/abort_transfer_operation" +require "./qdrant-api/models/alias_description" +require "./qdrant-api/models/alias_operations" +require "./qdrant-api/models/any_variants" +require "./qdrant-api/models/app_build_telemetry" +require "./qdrant-api/models/app_features_telemetry" +require "./qdrant-api/models/batch" +require "./qdrant-api/models/batch_payloads_inner" +require "./qdrant-api/models/batch_update200_response" +require "./qdrant-api/models/batch_vector_struct" +require "./qdrant-api/models/binary_quantization" +require "./qdrant-api/models/binary_quantization_config" +require "./qdrant-api/models/bool_index_params" +require "./qdrant-api/models/bool_index_type" +require "./qdrant-api/models/change_aliases_operation" +require "./qdrant-api/models/clear_payload_operation" +require "./qdrant-api/models/cluster_config_telemetry" +require "./qdrant-api/models/cluster_operations" +require "./qdrant-api/models/cluster_status" +require "./qdrant-api/models/cluster_status200_response" +require "./qdrant-api/models/cluster_status_one_of" +require "./qdrant-api/models/cluster_status_one_of1" +require "./qdrant-api/models/cluster_status_telemetry" +require "./qdrant-api/models/cluster_telemetry" +require "./qdrant-api/models/collection_cluster_info" +require "./qdrant-api/models/collection_cluster_info200_response" +require "./qdrant-api/models/collection_config" +require "./qdrant-api/models/collection_description" +require "./qdrant-api/models/collection_existence" +require "./qdrant-api/models/collection_exists200_response" +require "./qdrant-api/models/collection_info" +require "./qdrant-api/models/collection_params" +require "./qdrant-api/models/collection_params_diff" +require "./qdrant-api/models/collection_status" +require "./qdrant-api/models/collection_telemetry" +require "./qdrant-api/models/collection_telemetry_enum" +require "./qdrant-api/models/collections_aggregated_telemetry" +require "./qdrant-api/models/collections_aliases_response" +require "./qdrant-api/models/collections_response" +require "./qdrant-api/models/collections_telemetry" +require "./qdrant-api/models/compression_ratio" +require "./qdrant-api/models/condition" +require "./qdrant-api/models/consensus_config_telemetry" +require "./qdrant-api/models/consensus_thread_status" +require "./qdrant-api/models/consensus_thread_status_one_of" +require "./qdrant-api/models/consensus_thread_status_one_of1" +require "./qdrant-api/models/consensus_thread_status_one_of2" +require "./qdrant-api/models/context_example_pair" +require "./qdrant-api/models/context_input" +require "./qdrant-api/models/context_pair" +require "./qdrant-api/models/context_query" +require "./qdrant-api/models/count_points200_response" +require "./qdrant-api/models/count_request" +require "./qdrant-api/models/count_result" +require "./qdrant-api/models/create_alias" +require "./qdrant-api/models/create_alias_operation" +require "./qdrant-api/models/create_collection" +require "./qdrant-api/models/create_field_index" +require "./qdrant-api/models/create_field_index200_response" +require "./qdrant-api/models/create_shard_key200_response" +require "./qdrant-api/models/create_sharding_key" +require "./qdrant-api/models/create_sharding_key_operation" +require "./qdrant-api/models/create_snapshot200_response" +require "./qdrant-api/models/datatype" +require "./qdrant-api/models/datetime_index_params" +require "./qdrant-api/models/datetime_index_type" +require "./qdrant-api/models/datetime_range" +require "./qdrant-api/models/delete_alias" +require "./qdrant-api/models/delete_alias_operation" +require "./qdrant-api/models/delete_operation" +require "./qdrant-api/models/delete_payload" +require "./qdrant-api/models/delete_payload_operation" +require "./qdrant-api/models/delete_vectors" +require "./qdrant-api/models/delete_vectors_operation" +require "./qdrant-api/models/direction" +require "./qdrant-api/models/disabled" +require "./qdrant-api/models/discover_input" +require "./qdrant-api/models/discover_input_context" +require "./qdrant-api/models/discover_query" +require "./qdrant-api/models/discover_request" +require "./qdrant-api/models/discover_request_batch" +require "./qdrant-api/models/distance" +require "./qdrant-api/models/document" +require "./qdrant-api/models/drop_replica_operation" +require "./qdrant-api/models/drop_sharding_key" +require "./qdrant-api/models/drop_sharding_key_operation" +require "./qdrant-api/models/error_response" +require "./qdrant-api/models/error_response_status" +require "./qdrant-api/models/extended_point_id" +require "./qdrant-api/models/facet200_response" +require "./qdrant-api/models/facet_request" +require "./qdrant-api/models/facet_response" +require "./qdrant-api/models/facet_value" +require "./qdrant-api/models/facet_value_hit" +require "./qdrant-api/models/field_condition" +require "./qdrant-api/models/filter" +require "./qdrant-api/models/filter_selector" +require "./qdrant-api/models/filter_should" +require "./qdrant-api/models/float_index_params" +require "./qdrant-api/models/float_index_type" +require "./qdrant-api/models/fusion" +require "./qdrant-api/models/fusion_query" +require "./qdrant-api/models/geo_bounding_box" +require "./qdrant-api/models/geo_index_params" +require "./qdrant-api/models/geo_index_type" +require "./qdrant-api/models/geo_line_string" +require "./qdrant-api/models/geo_point" +require "./qdrant-api/models/geo_polygon" +require "./qdrant-api/models/geo_radius" +require "./qdrant-api/models/get_collection200_response" +require "./qdrant-api/models/get_collection_aliases200_response" +require "./qdrant-api/models/get_collections200_response" +require "./qdrant-api/models/get_locks200_response" +require "./qdrant-api/models/get_point200_response" +require "./qdrant-api/models/get_points200_response" +require "./qdrant-api/models/group_id" +require "./qdrant-api/models/groups_result" +require "./qdrant-api/models/grpc_telemetry" +require "./qdrant-api/models/has_id_condition" +require "./qdrant-api/models/hnsw_config" +require "./qdrant-api/models/hnsw_config_diff" +require "./qdrant-api/models/indexes" +require "./qdrant-api/models/indexes_one_of" +require "./qdrant-api/models/indexes_one_of1" +require "./qdrant-api/models/init_from" +require "./qdrant-api/models/integer_index_params" +require "./qdrant-api/models/integer_index_type" +require "./qdrant-api/models/is_empty_condition" +require "./qdrant-api/models/is_null_condition" +require "./qdrant-api/models/keyword_index_params" +require "./qdrant-api/models/keyword_index_type" +require "./qdrant-api/models/list_snapshots200_response" +require "./qdrant-api/models/local_shard_info" +require "./qdrant-api/models/local_shard_telemetry" +require "./qdrant-api/models/locks_option" +require "./qdrant-api/models/lookup_location" +require "./qdrant-api/models/match" +require "./qdrant-api/models/match_any" +require "./qdrant-api/models/match_except" +require "./qdrant-api/models/match_text" +require "./qdrant-api/models/match_value" +require "./qdrant-api/models/message_send_errors" +require "./qdrant-api/models/min_should" +require "./qdrant-api/models/modifier" +require "./qdrant-api/models/move_shard" +require "./qdrant-api/models/move_shard_operation" +require "./qdrant-api/models/multi_vector_comparator" +require "./qdrant-api/models/multi_vector_config" +require "./qdrant-api/models/named_sparse_vector" +require "./qdrant-api/models/named_vector" +require "./qdrant-api/models/named_vector_struct" +require "./qdrant-api/models/nearest_query" +require "./qdrant-api/models/nested" +require "./qdrant-api/models/nested_condition" +require "./qdrant-api/models/operation_duration_statistics" +require "./qdrant-api/models/optimizer_telemetry" +require "./qdrant-api/models/optimizers_config" +require "./qdrant-api/models/optimizers_config_diff" +require "./qdrant-api/models/optimizers_status" +require "./qdrant-api/models/optimizers_status_one_of" +require "./qdrant-api/models/order_by" +require "./qdrant-api/models/order_by_interface" +require "./qdrant-api/models/order_by_query" +require "./qdrant-api/models/order_value" +require "./qdrant-api/models/overwrite_payload_operation" +require "./qdrant-api/models/p2p_config_telemetry" +require "./qdrant-api/models/payload_field" +require "./qdrant-api/models/payload_field_schema" +require "./qdrant-api/models/payload_index_info" +require "./qdrant-api/models/payload_index_telemetry" +require "./qdrant-api/models/payload_schema_params" +require "./qdrant-api/models/payload_schema_type" +require "./qdrant-api/models/payload_selector" +require "./qdrant-api/models/payload_selector_exclude" +require "./qdrant-api/models/payload_selector_include" +require "./qdrant-api/models/payload_storage_type" +require "./qdrant-api/models/payload_storage_type_one_of" +require "./qdrant-api/models/payload_storage_type_one_of1" +require "./qdrant-api/models/peer_info" +require "./qdrant-api/models/point_group" +require "./qdrant-api/models/point_ids_list" +require "./qdrant-api/models/point_insert_operations" +require "./qdrant-api/models/point_request" +require "./qdrant-api/models/point_struct" +require "./qdrant-api/models/point_vectors" +require "./qdrant-api/models/points_batch" +require "./qdrant-api/models/points_list" +require "./qdrant-api/models/points_selector" +require "./qdrant-api/models/prefetch" +require "./qdrant-api/models/product_quantization" +require "./qdrant-api/models/product_quantization_config" +require "./qdrant-api/models/quantization_config" +require "./qdrant-api/models/quantization_config_diff" +require "./qdrant-api/models/quantization_search_params" +require "./qdrant-api/models/query" +require "./qdrant-api/models/query_batch_points200_response" +require "./qdrant-api/models/query_groups_request" +require "./qdrant-api/models/query_interface" +require "./qdrant-api/models/query_points200_response" +require "./qdrant-api/models/query_request" +require "./qdrant-api/models/query_request_batch" +require "./qdrant-api/models/query_request_prefetch" +require "./qdrant-api/models/query_response" +require "./qdrant-api/models/raft_info" +require "./qdrant-api/models/range" +require "./qdrant-api/models/range_interface" +require "./qdrant-api/models/read_consistency" +require "./qdrant-api/models/read_consistency_type" +require "./qdrant-api/models/recommend_example" +require "./qdrant-api/models/recommend_groups_request" +require "./qdrant-api/models/recommend_input" +require "./qdrant-api/models/recommend_query" +require "./qdrant-api/models/recommend_request" +require "./qdrant-api/models/recommend_request_batch" +require "./qdrant-api/models/recommend_strategy" +require "./qdrant-api/models/record" +require "./qdrant-api/models/recover_from_uploaded_snapshot202_response" +require "./qdrant-api/models/remote_shard_info" +require "./qdrant-api/models/remote_shard_telemetry" +require "./qdrant-api/models/rename_alias" +require "./qdrant-api/models/rename_alias_operation" +require "./qdrant-api/models/replica" +require "./qdrant-api/models/replica_set_telemetry" +require "./qdrant-api/models/replica_state" +require "./qdrant-api/models/replicate_shard" +require "./qdrant-api/models/replicate_shard_operation" +require "./qdrant-api/models/requests_telemetry" +require "./qdrant-api/models/resharding_direction" +require "./qdrant-api/models/resharding_info" +require "./qdrant-api/models/restart_transfer" +require "./qdrant-api/models/restart_transfer_operation" +require "./qdrant-api/models/running_environment_telemetry" +require "./qdrant-api/models/sample" +require "./qdrant-api/models/sample_query" +require "./qdrant-api/models/scalar_quantization" +require "./qdrant-api/models/scalar_quantization_config" +require "./qdrant-api/models/scalar_type" +require "./qdrant-api/models/scored_point" +require "./qdrant-api/models/scroll_points200_response" +require "./qdrant-api/models/scroll_request" +require "./qdrant-api/models/scroll_result" +require "./qdrant-api/models/search_batch_points200_response" +require "./qdrant-api/models/search_groups_request" +require "./qdrant-api/models/search_matrix_offsets200_response" +require "./qdrant-api/models/search_matrix_offsets_response" +require "./qdrant-api/models/search_matrix_pair" +require "./qdrant-api/models/search_matrix_pairs200_response" +require "./qdrant-api/models/search_matrix_pairs_response" +require "./qdrant-api/models/search_matrix_request" +require "./qdrant-api/models/search_params" +require "./qdrant-api/models/search_point_groups200_response" +require "./qdrant-api/models/search_points200_response" +require "./qdrant-api/models/search_request" +require "./qdrant-api/models/search_request_batch" +require "./qdrant-api/models/segment_config" +require "./qdrant-api/models/segment_info" +require "./qdrant-api/models/segment_telemetry" +require "./qdrant-api/models/segment_type" +require "./qdrant-api/models/set_payload" +require "./qdrant-api/models/set_payload_operation" +require "./qdrant-api/models/shard_key" +require "./qdrant-api/models/shard_key_selector" +require "./qdrant-api/models/shard_snapshot_location" +require "./qdrant-api/models/shard_snapshot_recover" +require "./qdrant-api/models/shard_status" +require "./qdrant-api/models/shard_transfer_info" +require "./qdrant-api/models/shard_transfer_method" +require "./qdrant-api/models/sharding_method" +require "./qdrant-api/models/snapshot_description" +require "./qdrant-api/models/snapshot_priority" +require "./qdrant-api/models/snapshot_recover" +require "./qdrant-api/models/sparse_index_config" +require "./qdrant-api/models/sparse_index_params" +require "./qdrant-api/models/sparse_index_type" +require "./qdrant-api/models/sparse_vector" +require "./qdrant-api/models/sparse_vector_data_config" +require "./qdrant-api/models/sparse_vector_params" +require "./qdrant-api/models/start_from" +require "./qdrant-api/models/state_role" +require "./qdrant-api/models/telemetry200_response" +require "./qdrant-api/models/telemetry_data" +require "./qdrant-api/models/text_index_params" +require "./qdrant-api/models/text_index_type" +require "./qdrant-api/models/tokenizer_type" +require "./qdrant-api/models/tracker_status" +require "./qdrant-api/models/tracker_status_one_of" +require "./qdrant-api/models/tracker_telemetry" +require "./qdrant-api/models/update_collection" +require "./qdrant-api/models/update_operation" +require "./qdrant-api/models/update_operations" +require "./qdrant-api/models/update_result" +require "./qdrant-api/models/update_status" +require "./qdrant-api/models/update_vectors" +require "./qdrant-api/models/update_vectors_operation" +require "./qdrant-api/models/upsert_operation" +require "./qdrant-api/models/uuid_index_params" +require "./qdrant-api/models/uuid_index_type" +require "./qdrant-api/models/value_variants" +require "./qdrant-api/models/values_count" +require "./qdrant-api/models/vector" +require "./qdrant-api/models/vector_data_config" +require "./qdrant-api/models/vector_data_info" +require "./qdrant-api/models/vector_index_searches_telemetry" +require "./qdrant-api/models/vector_input" +require "./qdrant-api/models/vector_params" +require "./qdrant-api/models/vector_params_diff" +require "./qdrant-api/models/vector_storage_datatype" +require "./qdrant-api/models/vector_storage_type" +require "./qdrant-api/models/vector_struct" +require "./qdrant-api/models/vectors_config" +require "./qdrant-api/models/version_info" +require "./qdrant-api/models/wal_config" +require "./qdrant-api/models/wal_config_diff" +require "./qdrant-api/models/web_api_telemetry" +require "./qdrant-api/models/with_lookup" +require "./qdrant-api/models/with_lookup_interface" +require "./qdrant-api/models/with_payload_interface" +require "./qdrant-api/models/with_vector" +require "./qdrant-api/models/write_ordering" + +# APIs +require "./qdrant-api/api/aliases" +require "./qdrant-api/api/cluster" +require "./qdrant-api/api/cluster/peer" +require "./qdrant-api/api/collections" +require "./qdrant-api/api/collections/index" +require "./qdrant-api/api/collections/points" +require "./qdrant-api/api/collections/shards" +require "./qdrant-api/api/collections/snapshots" +require "./qdrant-api/api/healthz" +require "./qdrant-api/api/issues" +require "./qdrant-api/api/livez" +require "./qdrant-api/api/locks" +require "./qdrant-api/api/metrics" +require "./qdrant-api/api/readyz" +require "./qdrant-api/api/root" +require "./qdrant-api/api/snapshots" +require "./qdrant-api/api/telemetry" + diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/aliases.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/aliases.cr new file mode 100644 index 000000000000..afce993584f2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/aliases.cr @@ -0,0 +1,17 @@ +require "json" + +module Qdrant::Api + class Aliases + def initialize(@conn : Connection); end + + # List collections aliases Get list of all existing collections aliases + def list() : Response(Qdrant::Api::GetCollectionAliases200Response) + @conn.request(Qdrant::Api::GetCollectionAliases200Response, + method: :GET, + path: "/aliases", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/cluster.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/cluster.cr new file mode 100644 index 000000000000..b1767ba2ccdc --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/cluster.cr @@ -0,0 +1,26 @@ +require "json" + +module Qdrant::Api + class Cluster + def initialize(@conn : Connection); end + + # Tries to recover current peer Raft state. + def recover() : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/cluster/recover", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Get cluster status info Get information about the current state and composition of the cluster + def status() : Response(Qdrant::Api::ClusterStatus200Response) + @conn.request(Qdrant::Api::ClusterStatus200Response, + method: :GET, + path: "/cluster", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/cluster/peer.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/cluster/peer.cr new file mode 100644 index 000000000000..c31c3d3139f0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/cluster/peer.cr @@ -0,0 +1,18 @@ +require "json" + +module Qdrant::Api + class Cluster::Peer + def initialize(@conn : Connection); end + + # Remove peer from the cluster Tries to remove peer from the cluster. Will return an error if peer has shards on it. + def delete(peer_id : Int32, *, force : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/cluster/peer/{peer_id}".sub("{peer_id}", Qdrant::Api.enc(peer_id)), + query: { "force" => force }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections.cr new file mode 100644 index 000000000000..08efbf72560a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections.cr @@ -0,0 +1,144 @@ +require "json" + +module Qdrant::Api + class Collections + def initialize(@conn : Connection); end + + # Update aliases of the collections + def aliases(change_aliases_operation : Qdrant::Api::ChangeAliasesOperation? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/aliases", + body: change_aliases_operation, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # List aliases for collection Get list of all aliases for a collection + def aliases_get(collection_name : String) : Response(Qdrant::Api::GetCollectionAliases200Response) + @conn.request(Qdrant::Api::GetCollectionAliases200Response, + method: :GET, + path: "/collections/{collection_name}/aliases".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Collection cluster info Get cluster information for a collection + def cluster(collection_name : String) : Response(Qdrant::Api::CollectionClusterInfo200Response) + @conn.request(Qdrant::Api::CollectionClusterInfo200Response, + method: :GET, + path: "/collections/{collection_name}/cluster".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Collection cluster info Get cluster information for a collection + def cluster_get(collection_name : String) : Response(Qdrant::Api::CollectionClusterInfo200Response) + @conn.request(Qdrant::Api::CollectionClusterInfo200Response, + method: :GET, + path: "/collections/{collection_name}/cluster".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Update collection cluster setup + def cluster_post(collection_name : String, cluster_operations : Qdrant::Api::ClusterOperations? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/cluster".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: cluster_operations, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Update collection cluster setup + def cluster_post_1(collection_name : String, cluster_operations : Qdrant::Api::ClusterOperations? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/cluster".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: cluster_operations, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete collection Drop collection and all associated data + def delete(collection_name : String, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/collections/{collection_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + query: { "timeout" => timeout }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Check the existence of a collection Returns \"true\" if the given collection name exists, and \"false\" otherwise + def exists(collection_name : String) : Response(Qdrant::Api::CollectionExists200Response) + @conn.request(Qdrant::Api::CollectionExists200Response, + method: :GET, + path: "/collections/{collection_name}/exists".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Facet a payload key with a given filter. Count points that satisfy the given filter for each unique value of a payload key. + def facet(collection_name : String, facet_request : Qdrant::Api::FacetRequest? = nil, *, timeout : Int32? = nil, consistency : Qdrant::Api::ReadConsistency? = nil) : Response(Qdrant::Api::Facet200Response) + @conn.request(Qdrant::Api::Facet200Response, + method: :POST, + path: "/collections/{collection_name}/facet".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: facet_request, + query: { "timeout" => timeout, "consistency" => consistency }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Collection info Get detailed information about specified existing collection + def get(collection_name : String) : Response(Qdrant::Api::GetCollection200Response) + @conn.request(Qdrant::Api::GetCollection200Response, + method: :GET, + path: "/collections/{collection_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # List collections Get list name of all existing collections + def list() : Response(Qdrant::Api::GetCollections200Response) + @conn.request(Qdrant::Api::GetCollections200Response, + method: :GET, + path: "/collections", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Update collection parameters Update parameters of the existing collection + def partial_update(collection_name : String, update_collection : Qdrant::Api::UpdateCollection? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PATCH, + path: "/collections/{collection_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: update_collection, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Create collection Create new collection with given parameters + def update(collection_name : String, create_collection : Qdrant::Api::CreateCollection? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: create_collection, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/index.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/index.cr new file mode 100644 index 000000000000..99591f1b189f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/index.cr @@ -0,0 +1,30 @@ +require "json" + +module Qdrant::Api + class Collections::Index + def initialize(@conn : Connection); end + + # Create index for field in collection Create index for field in collection + def bulk_update(collection_name : String, create_field_index : Qdrant::Api::CreateFieldIndex? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :PUT, + path: "/collections/{collection_name}/index".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: create_field_index, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete index for field in collection Delete field index for collection + def delete(collection_name : String, field_name : String, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :DELETE, + path: "/collections/{collection_name}/index/{field_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{field_name}", Qdrant::Api.enc(field_name)), + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/points.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/points.cr new file mode 100644 index 000000000000..fac298a055ce --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/points.cr @@ -0,0 +1,318 @@ +require "json" + +module Qdrant::Api + class Collections::Points + def initialize(@conn : Connection); end + + # Batch update points Apply a series of update operations for points, vectors and payloads + def batch(collection_name : String, update_operations : Qdrant::Api::UpdateOperations? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::BatchUpdate200Response) + @conn.request(Qdrant::Api::BatchUpdate200Response, + method: :POST, + path: "/collections/{collection_name}/points/batch".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: update_operations, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Upsert points Perform insert + updates on points. If point with given ID already exists - it will be overwritten. + def bulk_update(collection_name : String, point_insert_operations : Qdrant::Api::PointInsertOperations? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :PUT, + path: "/collections/{collection_name}/points".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: point_insert_operations, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Count points Count points which matches given filtering condition + def count(collection_name : String, count_request : Qdrant::Api::CountRequest? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CountPoints200Response) + @conn.request(Qdrant::Api::CountPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/count".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: count_request, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Get points Retrieve multiple points by specified IDs + def create(collection_name : String, point_request : Qdrant::Api::PointRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::GetPoints200Response) + @conn.request(Qdrant::Api::GetPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: point_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete points Delete points + def delete(collection_name : String, points_selector : Qdrant::Api::PointsSelector? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :POST, + path: "/collections/{collection_name}/points/delete".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: points_selector, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Discover points Use context and a target to find the most similar points to the target, constrained by the context. When using only the context (without a target), a special search - called context search - is performed where pairs of points are used to generate a loss that guides the search towards the zone where most positive examples overlap. This means that the score minimizes the scenario of finding a point closer to a negative than to a positive part of a pair. Since the score of a context relates to loss, the maximum score a point can get is 0.0, and it becomes normal that many points can have a score of 0.0. When using target (with or without context), the score behaves a little different: The integer part of the score represents the rank with respect to the context, while the decimal part of the score relates to the distance to the target. The context part of the score for each pair is calculated +1 if the point is closer to a positive than to a negative part of a pair, and -1 otherwise. + def discover(collection_name : String, discover_request : Qdrant::Api::DiscoverRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchPoints200Response) + @conn.request(Qdrant::Api::SearchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/discover".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: discover_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Discover batch points Look for points based on target and/or positive and negative example pairs, in batch. + def discover_batch(collection_name : String, discover_request_batch : Qdrant::Api::DiscoverRequestBatch? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchBatchPoints200Response) + @conn.request(Qdrant::Api::SearchBatchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/discover/batch".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: discover_request_batch, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Get point Retrieve full information of single point by id + def get(collection_name : String, id : Qdrant::Api::ExtendedPointId, *, consistency : Qdrant::Api::ReadConsistency? = nil) : Response(Qdrant::Api::GetPoint200Response) + @conn.request(Qdrant::Api::GetPoint200Response, + method: :GET, + path: "/collections/{collection_name}/points/{id}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{id}", Qdrant::Api.enc(id)), + query: { "consistency" => consistency }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Overwrite payload Replace full payload of points with new one + def payload(collection_name : String, set_payload : Qdrant::Api::SetPayload? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :PUT, + path: "/collections/{collection_name}/points/payload".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: set_payload, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Clear payload Remove all payload for specified points + def payload_clear(collection_name : String, points_selector : Qdrant::Api::PointsSelector? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :POST, + path: "/collections/{collection_name}/points/payload/clear".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: points_selector, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete payload Delete specified key payload for points + def payload_delete(collection_name : String, delete_payload : Qdrant::Api::DeletePayload? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :POST, + path: "/collections/{collection_name}/points/payload/delete".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: delete_payload, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Set payload Set payload values for points + def payload_post(collection_name : String, set_payload : Qdrant::Api::SetPayload? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :POST, + path: "/collections/{collection_name}/points/payload".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: set_payload, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Query points Universally query points. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries. + def query(collection_name : String, query_request : Qdrant::Api::QueryRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::QueryPoints200Response) + @conn.request(Qdrant::Api::QueryPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/query".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: query_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Query points in batch Universally query points in batch. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries. + def query_batch(collection_name : String, query_request_batch : Qdrant::Api::QueryRequestBatch? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::QueryBatchPoints200Response) + @conn.request(Qdrant::Api::QueryBatchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/query/batch".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: query_request_batch, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Query points, grouped by a given payload field Universally query points, grouped by a given payload field + def query_groups(collection_name : String, query_groups_request : Qdrant::Api::QueryGroupsRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchPointGroups200Response) + @conn.request(Qdrant::Api::SearchPointGroups200Response, + method: :POST, + path: "/collections/{collection_name}/points/query/groups".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: query_groups_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recommend points Look for the points which are closer to stored positive examples and at the same time further to negative examples. + def recommend(collection_name : String, recommend_request : Qdrant::Api::RecommendRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchPoints200Response) + @conn.request(Qdrant::Api::SearchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/recommend".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: recommend_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recommend batch points Look for the points which are closer to stored positive examples and at the same time further to negative examples. + def recommend_batch(collection_name : String, recommend_request_batch : Qdrant::Api::RecommendRequestBatch? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchBatchPoints200Response) + @conn.request(Qdrant::Api::SearchBatchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/recommend/batch".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: recommend_request_batch, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recommend point groups Look for the points which are closer to stored positive examples and at the same time further to negative examples, grouped by a given payload field. + def recommend_groups(collection_name : String, recommend_groups_request : Qdrant::Api::RecommendGroupsRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchPointGroups200Response) + @conn.request(Qdrant::Api::SearchPointGroups200Response, + method: :POST, + path: "/collections/{collection_name}/points/recommend/groups".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: recommend_groups_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Scroll points Scroll request - paginate over all points which matches given filtering condition + def scroll(collection_name : String, scroll_request : Qdrant::Api::ScrollRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::ScrollPoints200Response) + @conn.request(Qdrant::Api::ScrollPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/scroll".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: scroll_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Search points Retrieve closest points based on vector similarity and given filtering conditions + def search(collection_name : String, search_request : Qdrant::Api::SearchRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchPoints200Response) + @conn.request(Qdrant::Api::SearchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/search".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: search_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Search batch points Retrieve by batch the closest points based on vector similarity and given filtering conditions + def search_batch(collection_name : String, search_request_batch : Qdrant::Api::SearchRequestBatch? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchBatchPoints200Response) + @conn.request(Qdrant::Api::SearchBatchPoints200Response, + method: :POST, + path: "/collections/{collection_name}/points/search/batch".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: search_request_batch, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Search point groups Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field + def search_groups(collection_name : String, search_groups_request : Qdrant::Api::SearchGroupsRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchPointGroups200Response) + @conn.request(Qdrant::Api::SearchPointGroups200Response, + method: :POST, + path: "/collections/{collection_name}/points/search/groups".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: search_groups_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Search points matrix distance offsets Compute distance matrix for sampled points with an offset based output format + def search_matrix_offsets(collection_name : String, search_matrix_request : Qdrant::Api::SearchMatrixRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchMatrixOffsets200Response) + @conn.request(Qdrant::Api::SearchMatrixOffsets200Response, + method: :POST, + path: "/collections/{collection_name}/points/search/matrix/offsets".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: search_matrix_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Search points matrix distance pairs Compute distance matrix for sampled points with a pair based output format + def search_matrix_pairs(collection_name : String, search_matrix_request : Qdrant::Api::SearchMatrixRequest? = nil, *, consistency : Qdrant::Api::ReadConsistency? = nil, timeout : Int32? = nil) : Response(Qdrant::Api::SearchMatrixPairs200Response) + @conn.request(Qdrant::Api::SearchMatrixPairs200Response, + method: :POST, + path: "/collections/{collection_name}/points/search/matrix/pairs".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: search_matrix_request, + query: { "consistency" => consistency, "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Update vectors Update specified named vectors on points, keep unspecified vectors intact. + def vectors(collection_name : String, update_vectors : Qdrant::Api::UpdateVectors? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :PUT, + path: "/collections/{collection_name}/points/vectors".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: update_vectors, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete vectors Delete named vectors from the given points. + def vectors_delete(collection_name : String, delete_vectors : Qdrant::Api::DeleteVectors? = nil, *, wait : Bool? = nil, ordering : Qdrant::Api::WriteOrdering? = nil) : Response(Qdrant::Api::CreateFieldIndex200Response) + @conn.request(Qdrant::Api::CreateFieldIndex200Response, + method: :POST, + path: "/collections/{collection_name}/points/vectors/delete".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: delete_vectors, + query: { "wait" => wait, "ordering" => ordering }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/shards.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/shards.cr new file mode 100644 index 000000000000..f9bbd5f8f259 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/shards.cr @@ -0,0 +1,178 @@ +require "json" + +module Qdrant::Api + class Collections::Shards + def initialize(@conn : Connection); end + + # Create shard key + def bulk_update(collection_name : String, create_sharding_key : Qdrant::Api::CreateShardingKey? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}/shards".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: create_sharding_key, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Create shard key + def bulk_update_put(collection_name : String, create_sharding_key : Qdrant::Api::CreateShardingKey? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}/shards".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: create_sharding_key, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete shard key + def delete(collection_name : String, drop_sharding_key : Qdrant::Api::DropShardingKey? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/shards/delete".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: drop_sharding_key, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete shard key + def delete_post(collection_name : String, drop_sharding_key : Qdrant::Api::DropShardingKey? = nil, *, timeout : Int32? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/shards/delete".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: drop_sharding_key, + query: { "timeout" => timeout }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # List shards snapshots for a collection Get list of snapshots for a shard of a collection + def snapshots(collection_name : String, shard_id : Int32) : Response(Qdrant::Api::ListSnapshots200Response) + @conn.request(Qdrant::Api::ListSnapshots200Response, + method: :GET, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete shard snapshot Delete snapshot of a shard for a collection + def snapshots_delete(collection_name : String, shard_id : Int32, snapshot_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete shard snapshot Delete snapshot of a shard for a collection + def snapshots_delete_1(collection_name : String, shard_id : Int32, snapshot_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # List shards snapshots for a collection Get list of snapshots for a shard of a collection + def snapshots_get(collection_name : String, shard_id : Int32) : Response(Qdrant::Api::ListSnapshots200Response) + @conn.request(Qdrant::Api::ListSnapshots200Response, + method: :GET, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Download collection snapshot Download specified snapshot of a shard from a collection as a file + def snapshots_get_1(collection_name : String, shard_id : Int32, snapshot_name : String) : Response(::File) + @conn.request(::File, + method: :GET, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + accept: %w[application/json application/octet-stream], + auth: %w[api-key bearerAuth]) + end + + # Download collection snapshot Download specified snapshot of a shard from a collection as a file + def snapshots_get_2(collection_name : String, shard_id : Int32, snapshot_name : String) : Response(::File) + @conn.request(::File, + method: :GET, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + accept: %w[application/json application/octet-stream], + auth: %w[api-key bearerAuth]) + end + + # Create shard snapshot Create new snapshot of a shard for a collection + def snapshots_post(collection_name : String, shard_id : Int32, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateSnapshot200Response) + @conn.request(Qdrant::Api::CreateSnapshot200Response, + method: :POST, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Create shard snapshot Create new snapshot of a shard for a collection + def snapshots_post_1(collection_name : String, shard_id : Int32, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateSnapshot200Response) + @conn.request(Qdrant::Api::CreateSnapshot200Response, + method: :POST, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover from a snapshot Recover shard of a local collection data from a snapshot. This will overwrite any data, stored in this shard, for the collection. + def snapshots_recover(collection_name : String, shard_id : Int32, shard_snapshot_recover : Qdrant::Api::ShardSnapshotRecover? = nil, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/recover".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + body: shard_snapshot_recover, + query: { "wait" => wait }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover from a snapshot Recover shard of a local collection data from a snapshot. This will overwrite any data, stored in this shard, for the collection. + def snapshots_recover_put(collection_name : String, shard_id : Int32, shard_snapshot_recover : Qdrant::Api::ShardSnapshotRecover? = nil, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/recover".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + body: shard_snapshot_recover, + query: { "wait" => wait }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover shard from an uploaded snapshot Recover shard of a local collection from an uploaded snapshot. This will overwrite any data, stored on this node, for the collection shard. + def snapshots_upload(collection_name : String, shard_id : Int32, snapshot : ::File? = nil, *, wait : Bool? = nil, priority : Qdrant::Api::SnapshotPriority? = nil, checksum : String? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/upload".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + query: { "wait" => wait, "priority" => priority, "checksum" => checksum }, + form: Hash(String, Crest::ParamsValue){ "snapshot" => snapshot }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover shard from an uploaded snapshot Recover shard of a local collection from an uploaded snapshot. This will overwrite any data, stored on this node, for the collection shard. + def snapshots_upload_post(collection_name : String, shard_id : Int32, snapshot : ::File? = nil, *, wait : Bool? = nil, priority : Qdrant::Api::SnapshotPriority? = nil, checksum : String? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/shards/{shard_id}/snapshots/upload".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{shard_id}", Qdrant::Api.enc(shard_id)), + query: { "wait" => wait, "priority" => priority, "checksum" => checksum }, + form: Hash(String, Crest::ParamsValue){ "snapshot" => snapshot }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/snapshots.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/snapshots.cr new file mode 100644 index 000000000000..e50302db32a4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/collections/snapshots.cr @@ -0,0 +1,130 @@ +require "json" + +module Qdrant::Api + class Collections::Snapshots + def initialize(@conn : Connection); end + + # Create collection snapshot Create new snapshot for a collection + def create(collection_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateSnapshot200Response) + @conn.request(Qdrant::Api::CreateSnapshot200Response, + method: :POST, + path: "/collections/{collection_name}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Create collection snapshot Create new snapshot for a collection + def create_post(collection_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateSnapshot200Response) + @conn.request(Qdrant::Api::CreateSnapshot200Response, + method: :POST, + path: "/collections/{collection_name}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete collection snapshot Delete snapshot for a collection + def delete(collection_name : String, snapshot_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/collections/{collection_name}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete collection snapshot Delete snapshot for a collection + def delete_delete(collection_name : String, snapshot_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/collections/{collection_name}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Download collection snapshot Download specified snapshot from a collection as a file + def get(collection_name : String, snapshot_name : String) : Response(::File) + @conn.request(::File, + method: :GET, + path: "/collections/{collection_name}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + accept: %w[application/json application/octet-stream], + auth: %w[api-key bearerAuth]) + end + + # Download collection snapshot Download specified snapshot from a collection as a file + def get_get(collection_name : String, snapshot_name : String) : Response(::File) + @conn.request(::File, + method: :GET, + path: "/collections/{collection_name}/snapshots/{snapshot_name}".sub("{collection_name}", Qdrant::Api.enc(collection_name)).sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + accept: %w[application/json application/octet-stream], + auth: %w[api-key bearerAuth]) + end + + # List collection snapshots Get list of snapshots for a collection + def list(collection_name : String) : Response(Qdrant::Api::ListSnapshots200Response) + @conn.request(Qdrant::Api::ListSnapshots200Response, + method: :GET, + path: "/collections/{collection_name}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # List collection snapshots Get list of snapshots for a collection + def list_get(collection_name : String) : Response(Qdrant::Api::ListSnapshots200Response) + @conn.request(Qdrant::Api::ListSnapshots200Response, + method: :GET, + path: "/collections/{collection_name}/snapshots".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover from a snapshot Recover local collection data from a snapshot. This will overwrite any data, stored on this node, for the collection. If collection does not exist - it will be created. + def recover(collection_name : String, snapshot_recover : Qdrant::Api::SnapshotRecover? = nil, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}/snapshots/recover".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: snapshot_recover, + query: { "wait" => wait }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover from a snapshot Recover local collection data from a snapshot. This will overwrite any data, stored on this node, for the collection. If collection does not exist - it will be created. + def recover_put(collection_name : String, snapshot_recover : Qdrant::Api::SnapshotRecover? = nil, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :PUT, + path: "/collections/{collection_name}/snapshots/recover".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + body: snapshot_recover, + query: { "wait" => wait }, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover from an uploaded snapshot Recover local collection data from an uploaded snapshot. This will overwrite any data, stored on this node, for the collection. If collection does not exist - it will be created. + def upload(collection_name : String, snapshot : ::File? = nil, *, wait : Bool? = nil, priority : Qdrant::Api::SnapshotPriority? = nil, checksum : String? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/snapshots/upload".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + query: { "wait" => wait, "priority" => priority, "checksum" => checksum }, + form: Hash(String, Crest::ParamsValue){ "snapshot" => snapshot }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Recover from an uploaded snapshot Recover local collection data from an uploaded snapshot. This will overwrite any data, stored on this node, for the collection. If collection does not exist - it will be created. + def upload_post(collection_name : String, snapshot : ::File? = nil, *, wait : Bool? = nil, priority : Qdrant::Api::SnapshotPriority? = nil, checksum : String? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :POST, + path: "/collections/{collection_name}/snapshots/upload".sub("{collection_name}", Qdrant::Api.enc(collection_name)), + query: { "wait" => wait, "priority" => priority, "checksum" => checksum }, + form: Hash(String, Crest::ParamsValue){ "snapshot" => snapshot }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/healthz.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/healthz.cr new file mode 100644 index 000000000000..460c9e53ccf7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/healthz.cr @@ -0,0 +1,18 @@ +require "json" + +module Qdrant::Api + class Healthz + def initialize(@conn : Connection); end + + # Kubernetes healthz endpoint An endpoint for health checking used in Kubernetes. + def list() : Response(String) + @conn.request(String, + method: :GET, + path: "/healthz", + accept: %w[text/plain], + raw: true, + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/issues.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/issues.cr new file mode 100644 index 000000000000..f4a08c8c2f7b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/issues.cr @@ -0,0 +1,26 @@ +require "json" + +module Qdrant::Api + class Issues + def initialize(@conn : Connection); end + + # Clear issues Removes all issues reported so far + def bulk_destroy() : Response(Bool) + @conn.request(Bool, + method: :DELETE, + path: "/issues", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Get issues Get a report of performance issues and configuration suggestions + def list() : Response(JSON::Any) + @conn.request(JSON::Any, + method: :GET, + path: "/issues", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/livez.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/livez.cr new file mode 100644 index 000000000000..dfd49dbeb59f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/livez.cr @@ -0,0 +1,18 @@ +require "json" + +module Qdrant::Api + class Livez + def initialize(@conn : Connection); end + + # Kubernetes livez endpoint An endpoint for health checking used in Kubernetes. + def list() : Response(String) + @conn.request(String, + method: :GET, + path: "/livez", + accept: %w[text/plain], + raw: true, + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/locks.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/locks.cr new file mode 100644 index 000000000000..a61b08051ea1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/locks.cr @@ -0,0 +1,28 @@ +require "json" + +module Qdrant::Api + class Locks + def initialize(@conn : Connection); end + + # Set lock options Set lock options. If write is locked, all write operations and collection creation are forbidden. Returns previous lock options + def create(locks_option : Qdrant::Api::LocksOption? = nil) : Response(Qdrant::Api::GetLocks200Response) + @conn.request(Qdrant::Api::GetLocks200Response, + method: :POST, + path: "/locks", + body: locks_option, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Get lock options Get lock options. If write is locked, all write operations and collection creation are forbidden + def list() : Response(Qdrant::Api::GetLocks200Response) + @conn.request(Qdrant::Api::GetLocks200Response, + method: :GET, + path: "/locks", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/metrics.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/metrics.cr new file mode 100644 index 000000000000..fffeb52a344d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/metrics.cr @@ -0,0 +1,19 @@ +require "json" + +module Qdrant::Api + class Metrics + def initialize(@conn : Connection); end + + # Collect Prometheus metrics data Collect metrics data including app info, collections info, cluster info and statistics + def list(*, anonymize : Bool? = nil) : Response(String) + @conn.request(String, + method: :GET, + path: "/metrics", + query: { "anonymize" => anonymize }, + accept: %w[text/plain], + raw: true, + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/readyz.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/readyz.cr new file mode 100644 index 000000000000..c1b4d0c32e95 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/readyz.cr @@ -0,0 +1,18 @@ +require "json" + +module Qdrant::Api + class Readyz + def initialize(@conn : Connection); end + + # Kubernetes readyz endpoint An endpoint for health checking used in Kubernetes. + def list() : Response(String) + @conn.request(String, + method: :GET, + path: "/readyz", + accept: %w[text/plain], + raw: true, + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/root.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/root.cr new file mode 100644 index 000000000000..32f0c94b133d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/root.cr @@ -0,0 +1,17 @@ +require "json" + +module Qdrant::Api + class Root + def initialize(@conn : Connection); end + + # Returns information about the running Qdrant instance Returns information about the running Qdrant instance like version and commit id + def list() : Response(Qdrant::Api::VersionInfo) + @conn.request(Qdrant::Api::VersionInfo, + method: :GET, + path: "/", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/snapshots.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/snapshots.cr new file mode 100644 index 000000000000..470f002c8e21 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/snapshots.cr @@ -0,0 +1,46 @@ +require "json" + +module Qdrant::Api + class Snapshots + def initialize(@conn : Connection); end + + # Create storage snapshot Create new snapshot of the whole storage + def create(*, wait : Bool? = nil) : Response(Qdrant::Api::CreateSnapshot200Response) + @conn.request(Qdrant::Api::CreateSnapshot200Response, + method: :POST, + path: "/snapshots", + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Delete storage snapshot Delete snapshot of the whole storage + def delete(snapshot_name : String, *, wait : Bool? = nil) : Response(Qdrant::Api::CreateShardKey200Response) + @conn.request(Qdrant::Api::CreateShardKey200Response, + method: :DELETE, + path: "/snapshots/{snapshot_name}".sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + query: { "wait" => wait }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + + # Download storage snapshot Download specified snapshot of the whole storage as a file + def get(snapshot_name : String) : Response(::File) + @conn.request(::File, + method: :GET, + path: "/snapshots/{snapshot_name}".sub("{snapshot_name}", Qdrant::Api.enc(snapshot_name)), + accept: %w[application/json application/octet-stream], + auth: %w[api-key bearerAuth]) + end + + # List of storage snapshots Get list of snapshots of the whole storage + def list() : Response(Qdrant::Api::ListSnapshots200Response) + @conn.request(Qdrant::Api::ListSnapshots200Response, + method: :GET, + path: "/snapshots", + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api/telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api/telemetry.cr new file mode 100644 index 000000000000..d39edfbee81e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api/telemetry.cr @@ -0,0 +1,18 @@ +require "json" + +module Qdrant::Api + class Telemetry + def initialize(@conn : Connection); end + + # Collect telemetry data Collect telemetry data including app info, system info, collections info, cluster info, configs and statistics + def list(*, anonymize : Bool? = nil) : Response(Qdrant::Api::Telemetry200Response) + @conn.request(Qdrant::Api::Telemetry200Response, + method: :GET, + path: "/telemetry", + query: { "anonymize" => anonymize }, + accept: %w[application/json], + auth: %w[api-key bearerAuth]) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/api_error.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/api_error.cr new file mode 100644 index 000000000000..c3ade0864c85 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/api_error.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ApiError < Exception + getter code : Int32? + getter response_headers : HTTP::Headers? + + # Usage examples: + # ApiError.new + # ApiError.new(message: "message") + # ApiError.new(code: 500, response_headers: HTTP::Headers.new, message: "") + # ApiError.new(code: 404, message: "Not Found") + def initialize(@code : Int32?, @response_headers : HTTP::Headers?, message : String?) + super(message) + end + + def initialize(@code : Int32?, @response_headers : HTTP::Headers?, body : String) + msg = body.empty? ? "the server returns an error but the HTTP response body is empty." : body + super(msg) + @message = msg + end + + def initialize(message : String) + super(message) + @code = nil + @response_headers = nil + end + + def initialize + super(nil) + @code = nil + @response_headers = nil + end + + # Override to_s to display a friendly error message + def to_s(io : IO) : Nil + io << "\nHTTP status code: #{code}" if @code + io << "\nResponse headers: #{response_headers}" if @response_headers + if message.nil? || message.try &.empty? + io << "\nError message: the server returns an error but the HTTP response body is empty." + else + io << "\nResponse body: #{message}" + end + end + end +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/client.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/client.cr new file mode 100644 index 000000000000..7bed74904803 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/client.cr @@ -0,0 +1,161 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Client + getter connection : Connection + + def initialize(*, host : String, token : String? = nil, scheme : String = "https") + cfg = Configuration.new + cfg.host = host + cfg.scheme = scheme + cfg.access_token = token if token + @connection = Connection.new(cfg) + end + + def initialize(@connection : Connection); end + def aliases : Aliases + @aliases ||= Aliases.new(@connection) + end + + @aliases : Aliases? + def cluster : Cluster + @cluster ||= Cluster.new(@connection) + end + + @cluster : Cluster? + def collections : Collections + @collections ||= Collections.new(@connection) + end + + @collections : Collections? + def healthz : Healthz + @healthz ||= Healthz.new(@connection) + end + + @healthz : Healthz? + def issues : Issues + @issues ||= Issues.new(@connection) + end + + @issues : Issues? + def livez : Livez + @livez ||= Livez.new(@connection) + end + + @livez : Livez? + def locks : Locks + @locks ||= Locks.new(@connection) + end + + @locks : Locks? + def metrics : Metrics + @metrics ||= Metrics.new(@connection) + end + + @metrics : Metrics? + def readyz : Readyz + @readyz ||= Readyz.new(@connection) + end + + @readyz : Readyz? + def root : Root + @root ||= Root.new(@connection) + end + + @root : Root? + def snapshots : Snapshots + @snapshots ||= Snapshots.new(@connection) + end + + @snapshots : Snapshots? + def telemetry : Telemetry + @telemetry ||= Telemetry.new(@connection) + end + + @telemetry : Telemetry? + end + + class Aliases + def initialize(@conn : Connection); end + end + + class Cluster + def initialize(@conn : Connection); end + + def peer : Cluster::Peer + @peer ||= Cluster::Peer.new(@conn) + end + + @peer : Cluster::Peer? + end + + class Collections + def initialize(@conn : Connection); end + + def index : Collections::Index + @index ||= Collections::Index.new(@conn) + end + + @index : Collections::Index? + + def points : Collections::Points + @points ||= Collections::Points.new(@conn) + end + + @points : Collections::Points? + + def shards : Collections::Shards + @shards ||= Collections::Shards.new(@conn) + end + + @shards : Collections::Shards? + + def snapshots : Collections::Snapshots + @snapshots ||= Collections::Snapshots.new(@conn) + end + + @snapshots : Collections::Snapshots? + end + + class Healthz + def initialize(@conn : Connection); end + end + + class Issues + def initialize(@conn : Connection); end + end + + class Livez + def initialize(@conn : Connection); end + end + + class Locks + def initialize(@conn : Connection); end + end + + class Metrics + def initialize(@conn : Connection); end + end + + class Readyz + def initialize(@conn : Connection); end + end + + class Root + def initialize(@conn : Connection); end + end + + class Snapshots + def initialize(@conn : Connection); end + end + + class Telemetry + def initialize(@conn : Connection); end + end +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/configuration.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/configuration.cr new file mode 100644 index 000000000000..3da810411365 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/configuration.cr @@ -0,0 +1,232 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "base64" +require "crest" +require "http" +require "log" + +module Qdrant::Api + class Configuration + # Defines url scheme + property scheme : String + + # Defines url host + property host : String + + # Defines url base path + property base_path : String + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key[:api_key] = "xxx" + property api_key : Hash(Symbol, String) + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix[:api_key] = "Token" + property api_key_prefix : Hash(Symbol, String) + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + property username : String? + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + property password : String? + + # Defines the access token (Bearer) used with OAuth2. + property access_token : String? + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + property debugging : Bool + + # Enable the underlying HTTP client's (crest) request/response logging. Off by default, so the + # shard produces no log output unless a consumer opts in (e.g. a higher-level client wrapper + # can expose `config.logging = true`). Independent of `debugging`. + property logging : Bool + + # Logger used by crest when `logging` is enabled. Defaults to `Crest::CommonLogger`; assign a + # custom `Crest::Logger` to control formatting/output. + property logger : Crest::Logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + property temp_folder_path : String? + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + property timeout : Int32 + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + property client_side_validation : Bool + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + #TODO attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + # TODO attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + # TODO attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + # TODO attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + # TODO attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to Nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + #property params_encoding : String? + + # Default headers sent with every request. + property default_headers : HTTP::Headers = HTTP::Headers.new + + # Params encoder used to encode array query parameters. + # Default: Crest::NestedParamsEncoder (encodes arrays as key=a&key=b). + property params_encoder : Crest::ParamsEncoder.class = Crest::NestedParamsEncoder + + # Create a new `Configuration`. + def initialize + @scheme = "http" + @host = "localhost:6333" + @base_path = "" + @api_key = {} of Symbol => String + @api_key_prefix = {} of Symbol => String + @timeout = 0 + @client_side_validation = true + #@params_encoding = nil + #@cert_file = nil + #@key_file = nil + @debugging = false + @logging = false + @logger = Crest::CommonLogger.new + @username = nil + @password = nil + @access_token = nil + @temp_folder_path = nil + end + + # Create a new `Configuration` with block. + # + # ``` + # config = Qdrant::Api::Configuration.new do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # ``` + def initialize + initialize + yield self + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + # Configure object with block. + def configure + yield self + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, "") + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, "").split("/").first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, "/") + @base_path = "" if @base_path == "/" + end + + # Returns the base URL for requests. + def base_url + "#{scheme}://#{[host, base_path].join("/").gsub(/\/+/, "/")}".sub(/\/+\z/, "") + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name) + if prefix = @api_key_prefix[param_name]? + "#{prefix} #{@api_key[param_name]}" + else + @api_key[param_name]? || "" + end + end + + # Gets Basic Auth token string + def basic_auth_token + "Basic " + Base64.strict_encode("#{username}:#{password}") + end + + # Applies authentication credentials to request headers and query params. + # Called by Connection#request for every outgoing request. + def apply_auth!(headers : HTTP::Headers, params : Hash(String, String | Array(String)), auth_names : Array(String)) : Nil + if auth_names.includes?("api-key") + value = api_key_with_prefix(:"api-key") + unless value.empty? + headers["api-key"] = value + end + end + if auth_names.includes?("bearerAuth") + if token = @access_token + headers["Authorization"] = "Bearer #{token}" + end + end + end + + end +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/connection.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/connection.cr new file mode 100644 index 000000000000..530bc9688e68 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/connection.cr @@ -0,0 +1,96 @@ +require "crest" +require "json" +require "log" +require "uri" + +module Qdrant::Api + Log = ::Log.for("qdrant-api") + + def self.enc(value) : String + URI.encode_path_segment(value.to_s) + end + + class Connection + getter config : Configuration + + def initialize(@config : Configuration); end + + def request(klass : T.class, *, method : Symbol, path : String, + body = nil, query : Hash(String, _)? = nil, + form : Hash(String, Crest::ParamsValue)? = nil, + header : Hash(String, String?)? = nil, + accept : Array(String) = %w[application/json], + content_type : Array(String) = %w[application/json], + auth : Array(String) = %w[], + raw : Bool = false) : Response(T) forall T + Log.debug { "#{method} #{path}" } if config.debugging + + headers = config.default_headers.dup + header.try &.each { |k, v| headers[k] = v unless v.nil? } + # Prefer a JSON media type when the operation offers one: the body is always + # JSON-decoded (T.from_json), so requesting application/xml first (as some specs + # list it) would yield a response we can't parse. + headers["Accept"] = (accept.find(&.includes?("json")) || accept.first) unless accept.empty? + q = {} of String => String | Array(String) + query.try &.each do |k, v| + next if v.nil? + case v + when Array then q[k] = v.map(&.to_s) + else q[k] = v.to_s + end + end + config.apply_auth!(headers, q, auth) + + # Determine what to pass as the form/body argument to Crest + # If there's a JSON body, serialize it and pass as raw string form + body_str : String? = body.nil? ? nil : body.to_json + headers["Content-Type"] = content_type.first if body_str && !content_type.empty? + + crest_form : Hash(String, Crest::ParamsValue) | String | Nil = + if body_str + body_str + elsif form && !form.empty? + form + else + nil + end + + headers_hash = {} of String => String | Array(String) + headers.each { |k, vs| headers_hash[k] = vs.size == 1 ? vs.first : vs } + + resp = Crest::Request.execute( + method, + config.base_url + path, + crest_form, + headers: headers_hash, + params: q, + params_encoder: config.params_encoder, + logging: config.logging, + logger: config.logger, + handle_errors: false) + + resp_headers = to_http_headers(resp.headers) + unless 200 <= resp.status_code < 300 + raise ApiError.new(resp.status_code, resp_headers, resp.body) + end + + # `raw` (set by operations whose response isn't JSON, e.g. text/plain or binary) returns the + # body untouched; a String return type is otherwise JSON-decoded (unquoted). + value = {% if T == Nil %} nil {% elsif T == String %} (raw ? resp.body : String.from_json(resp.body)) {% else %} T.from_json(resp.body) {% end %} + Response(T).new(value, resp.status_code, resp_headers) + end + + # Crest returns headers as a Hash whose values may be a String or an Array(String); + # convert to the idiomatic HTTP::Headers used by Response/ApiError. + private def to_http_headers(raw) : HTTP::Headers + headers = HTTP::Headers.new + raw.each do |key, value| + case value + when Array then value.each { |v| headers.add(key, v) } + else headers[key] = value.to_s + end + end + headers + end + end +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/abort_shard_transfer.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/abort_shard_transfer.cr new file mode 100644 index 000000000000..1d4bab5661d3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/abort_shard_transfer.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class AbortShardTransfer + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "to_peer_id", emit_null: false)] + property to_peer_id : Int32 + + @[JSON::Field(key: "from_peer_id", emit_null: false)] + property from_peer_id : Int32 + + validates(shard_id, Int32, false, minimum: 0) + validates(to_peer_id, Int32, false, minimum: 0) + validates(from_peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @to_peer_id : Int32, @from_peer_id : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = to_peer_id_validation_error(@to_peer_id)) + invalid_properties.push(msg) + end + if (msg = from_peer_id_validation_error(@from_peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, to_peer_id, from_peer_id) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/abort_transfer_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/abort_transfer_operation.cr new file mode 100644 index 000000000000..ed85218ad027 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/abort_transfer_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class AbortTransferOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "abort_transfer", emit_null: false)] + property abort_transfer : AbortShardTransfer + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@abort_transfer : AbortShardTransfer) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(abort_transfer) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/alias_description.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/alias_description.cr new file mode 100644 index 000000000000..05f499d94d65 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/alias_description.cr @@ -0,0 +1,45 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class AliasDescription + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "alias_name", emit_null: false)] + property alias_name : String + + @[JSON::Field(key: "collection_name", emit_null: false)] + property collection_name : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@alias_name : String, @collection_name : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(alias_name, collection_name) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/alias_operations.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/alias_operations.cr new file mode 100644 index 000000000000..d1db1f465e1e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/alias_operations.cr @@ -0,0 +1,81 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Group of all the possible operations related to collection aliases + # AliasOperations (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class AliasOperations + getter value + + def initialize(@value : CreateAliasOperation) + end + def initialize(@value : DeleteAliasOperation) + end + def initialize(@value : RenameAliasOperation) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + CreateAliasOperation, DeleteAliasOperation, RenameAliasOperation + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(CreateAliasOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeleteAliasOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(RenameAliasOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in AliasOperations (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(CreateAliasOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeleteAliasOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(RenameAliasOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in AliasOperations (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/any_variants.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/any_variants.cr new file mode 100644 index 000000000000..b84464916d19 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/any_variants.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # AnyVariants (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class AnyVariants + getter value + + def initialize(@value : Set(Int64)) + end + def initialize(@value : Set(String)) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Set(Int64), Set(String) + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Set(Int64).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Set(String).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in AnyVariants (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Set(Int64).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Set(String).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in AnyVariants (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/app_build_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/app_build_telemetry.cr new file mode 100644 index 000000000000..cdc75a4c5014 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/app_build_telemetry.cr @@ -0,0 +1,61 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class AppBuildTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "name", emit_null: false)] + property name : String + + @[JSON::Field(key: "version", emit_null: false)] + property version : String + + @[JSON::Field(key: "startup", emit_null: false)] + property startup : Time + + # Optional properties + @[JSON::Field(key: "features", emit_null: false)] + property features : AppFeaturesTelemetry? + + @[JSON::Field(key: "system", emit_null: false)] + property system : RunningEnvironmentTelemetry? + + @[JSON::Field(key: "jwt_rbac", emit_null: false)] + property jwt_rbac : Bool? + + @[JSON::Field(key: "hide_jwt_dashboard", emit_null: false)] + property hide_jwt_dashboard : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String, @version : String, @startup : Time, @features : AppFeaturesTelemetry? = nil, @system : RunningEnvironmentTelemetry? = nil, @jwt_rbac : Bool? = nil, @hide_jwt_dashboard : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, version, features, system, jwt_rbac, hide_jwt_dashboard, startup) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/app_features_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/app_features_telemetry.cr new file mode 100644 index 000000000000..e83284519a4e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/app_features_telemetry.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class AppFeaturesTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "debug", emit_null: false)] + property debug : Bool + + @[JSON::Field(key: "web_feature", emit_null: false)] + property web_feature : Bool + + @[JSON::Field(key: "service_debug_feature", emit_null: false)] + property service_debug_feature : Bool + + @[JSON::Field(key: "recovery_mode", emit_null: false)] + property recovery_mode : Bool + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@debug : Bool, @web_feature : Bool, @service_debug_feature : Bool, @recovery_mode : Bool) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(debug, web_feature, service_debug_feature, recovery_mode) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch.cr new file mode 100644 index 000000000000..b8309149c7f6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Batch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "ids", emit_null: false)] + property ids : Array(ExtendedPointId) + + @[JSON::Field(key: "vectors", emit_null: false)] + property vectors : BatchVectorStruct + + # Optional properties + @[JSON::Field(key: "payloads", emit_null: false)] + property payloads : Array(BatchPayloadsInner)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@ids : Array(ExtendedPointId), @vectors : BatchVectorStruct, @payloads : Array(BatchPayloadsInner)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(ids, vectors, payloads) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_payloads_inner.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_payloads_inner.cr new file mode 100644 index 000000000000..6e3bcb40a482 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_payloads_inner.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # BatchPayloadsInner (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class BatchPayloadsInner + getter value + + def initialize(@value : Hash(String, JSON::Any)) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Hash(String, JSON::Any) + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Hash(String, JSON::Any).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in BatchPayloadsInner (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Hash(String, JSON::Any).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in BatchPayloadsInner (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_update200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_update200_response.cr new file mode 100644 index 000000000000..47324b676552 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_update200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class BatchUpdate200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Array(UpdateResult)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Array(UpdateResult)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_vector_struct.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_vector_struct.cr new file mode 100644 index 000000000000..3eed8338a066 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/batch_vector_struct.cr @@ -0,0 +1,90 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # BatchVectorStruct (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class BatchVectorStruct + getter value + + def initialize(@value : Array(Array(Array(Float32)))) + end + def initialize(@value : Array(Array(Float32))) + end + def initialize(@value : Array(Document)) + end + def initialize(@value : Hash(String, Array(Vector))) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Array(Array(Float32))), Array(Array(Float32)), Array(Document), Hash(String, Array(Vector)) + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Array(Array(Float32))).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Array(Float32)).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Document).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Hash(String, Array(Vector)).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in BatchVectorStruct (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Array(Array(Float32))).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Array(Float32)).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Document).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Hash(String, Array(Vector)).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in BatchVectorStruct (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/binary_quantization.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/binary_quantization.cr new file mode 100644 index 000000000000..dcb8ccce1de6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/binary_quantization.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class BinaryQuantization + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "binary", emit_null: false)] + property binary : BinaryQuantizationConfig + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@binary : BinaryQuantizationConfig) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(binary) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/binary_quantization_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/binary_quantization_config.cr new file mode 100644 index 000000000000..0462bb82a6d2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/binary_quantization_config.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class BinaryQuantizationConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + @[JSON::Field(key: "always_ram", emit_null: false)] + property always_ram : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@always_ram : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(always_ram) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/bool_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/bool_index_params.cr new file mode 100644 index 000000000000..cb122ca39eae --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/bool_index_params.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class BoolIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : BoolIndexType + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : BoolIndexType) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/bool_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/bool_index_type.cr new file mode 100644 index 000000000000..d2682d9e382c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/bool_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # BoolIndexType (OpenAPI enum). Allowed values: "bool". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias BoolIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/change_aliases_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/change_aliases_operation.cr new file mode 100644 index 000000000000..ebe8f67c5f95 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/change_aliases_operation.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Operation for performing changes of collection aliases. Alias changes are atomic, meaning that no collection modifications can happen between alias operations. + class ChangeAliasesOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "actions", emit_null: false)] + property actions : Array(AliasOperations) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@actions : Array(AliasOperations)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(actions) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/clear_payload_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/clear_payload_operation.cr new file mode 100644 index 000000000000..d89faef293c6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/clear_payload_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ClearPayloadOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "clear_payload", emit_null: false)] + property clear_payload : PointsSelector + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@clear_payload : PointsSelector) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(clear_payload) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_config_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_config_telemetry.cr new file mode 100644 index 000000000000..f30b96a36fd7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_config_telemetry.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ClusterConfigTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "grpc_timeout_ms", emit_null: false)] + property grpc_timeout_ms : Int32 + + @[JSON::Field(key: "p2p", emit_null: false)] + property p2p : P2pConfigTelemetry + + @[JSON::Field(key: "consensus", emit_null: false)] + property consensus : ConsensusConfigTelemetry + + validates(grpc_timeout_ms, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@grpc_timeout_ms : Int32, @p2p : P2pConfigTelemetry, @consensus : ConsensusConfigTelemetry) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = grpc_timeout_ms_validation_error(@grpc_timeout_ms)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(grpc_timeout_ms, p2p, consensus) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_operations.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_operations.cr new file mode 100644 index 000000000000..c4f2dac58c3d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_operations.cr @@ -0,0 +1,120 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ClusterOperations (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ClusterOperations + getter value + + def initialize(@value : AbortTransferOperation) + end + def initialize(@value : CreateShardingKeyOperation) + end + def initialize(@value : DropReplicaOperation) + end + def initialize(@value : DropShardingKeyOperation) + end + def initialize(@value : MoveShardOperation) + end + def initialize(@value : ReplicateShardOperation) + end + def initialize(@value : RestartTransferOperation) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + AbortTransferOperation, CreateShardingKeyOperation, DropReplicaOperation, DropShardingKeyOperation, MoveShardOperation, ReplicateShardOperation, RestartTransferOperation + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(AbortTransferOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(CreateShardingKeyOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DropReplicaOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DropShardingKeyOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(MoveShardOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ReplicateShardOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(RestartTransferOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ClusterOperations (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(AbortTransferOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(CreateShardingKeyOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DropReplicaOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DropShardingKeyOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(MoveShardOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ReplicateShardOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(RestartTransferOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ClusterOperations (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status.cr new file mode 100644 index 000000000000..8411a0ec6b2d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Information about current cluster status and structure + # ClusterStatus (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. + class ClusterStatus + getter value + + def initialize(@value : ClusterStatusOneOf) + end + def initialize(@value : ClusterStatusOneOf1) + end + + # List of classes defined in oneOf (OpenAPI v3) + def self.openapi_one_of + [ + ClusterStatusOneOf, ClusterStatusOneOf1 + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(ClusterStatusOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ClusterStatusOneOf1.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ClusterStatus (oneOf)", 0, 0) + end + + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(ClusterStatusOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ClusterStatusOneOf1.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ClusterStatus (oneOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status200_response.cr new file mode 100644 index 000000000000..e99782b542b1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ClusterStatus200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : ClusterStatus? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : ClusterStatus? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_one_of.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_one_of.cr new file mode 100644 index 000000000000..bb33e8009661 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_one_of.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ClusterStatusOneOf + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "status", emit_null: false)] + property status : String + + validates(status, String, false, enum: ["disabled"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@status : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = status_validation_error(@status)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(status) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_one_of1.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_one_of1.cr new file mode 100644 index 000000000000..12a6dc5888f8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_one_of1.cr @@ -0,0 +1,69 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Description of enabled cluster + class ClusterStatusOneOf1 + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "status", emit_null: false)] + property status : String + + # ID of this peer + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32 + + # Peers composition of the cluster with main information + @[JSON::Field(key: "peers", emit_null: false)] + property peers : Hash(String, PeerInfo) + + @[JSON::Field(key: "raft_info", emit_null: false)] + property raft_info : RaftInfo + + @[JSON::Field(key: "consensus_thread_status", emit_null: false)] + property consensus_thread_status : ConsensusThreadStatus + + # Consequent failures of message send operations in consensus by peer address. On the first success to send to that peer - entry is removed from this hashmap. + @[JSON::Field(key: "message_send_failures", emit_null: false)] + property message_send_failures : Hash(String, MessageSendErrors) + + validates(status, String, false, enum: ["enabled"]) + validates(peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@status : String, @peer_id : Int32, @peers : Hash(String, PeerInfo), @raft_info : RaftInfo, @consensus_thread_status : ConsensusThreadStatus, @message_send_failures : Hash(String, MessageSendErrors)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = status_validation_error(@status)) + invalid_properties.push(msg) + end + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(status, peer_id, peers, raft_info, consensus_thread_status, message_send_failures) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_telemetry.cr new file mode 100644 index 000000000000..4a09780a394b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_status_telemetry.cr @@ -0,0 +1,84 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ClusterStatusTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "number_of_peers", emit_null: false)] + property number_of_peers : Int32 + + @[JSON::Field(key: "term", emit_null: false)] + property term : Int32 + + @[JSON::Field(key: "commit", emit_null: false)] + property commit : Int32 + + @[JSON::Field(key: "pending_operations", emit_null: false)] + property pending_operations : Int32 + + @[JSON::Field(key: "is_voter", emit_null: false)] + property is_voter : Bool + + @[JSON::Field(key: "consensus_thread_status", emit_null: false)] + property consensus_thread_status : ConsensusThreadStatus + + # Optional properties + @[JSON::Field(key: "role", emit_null: false)] + property role : StateRole? + + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32? + + validates(number_of_peers, Int32, false, minimum: 0) + validates(term, Int32, false, minimum: 0) + validates(commit, Int32, false, minimum: 0) + validates(pending_operations, Int32, false, minimum: 0) + validates(peer_id, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@number_of_peers : Int32, @term : Int32, @commit : Int32, @pending_operations : Int32, @is_voter : Bool, @consensus_thread_status : ConsensusThreadStatus, @role : StateRole? = nil, @peer_id : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = number_of_peers_validation_error(@number_of_peers)) + invalid_properties.push(msg) + end + if (msg = term_validation_error(@term)) + invalid_properties.push(msg) + end + if (msg = commit_validation_error(@commit)) + invalid_properties.push(msg) + end + if (msg = pending_operations_validation_error(@pending_operations)) + invalid_properties.push(msg) + end + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(number_of_peers, term, commit, pending_operations, role, is_voter, peer_id, consensus_thread_status) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_telemetry.cr new file mode 100644 index 000000000000..6cb22addd13b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/cluster_telemetry.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ClusterTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "enabled", emit_null: false)] + property enabled : Bool + + # Optional properties + @[JSON::Field(key: "status", emit_null: false)] + property status : ClusterStatusTelemetry? + + @[JSON::Field(key: "config", emit_null: false)] + property config : ClusterConfigTelemetry? + + @[JSON::Field(key: "peers", emit_null: false)] + property peers : Hash(String, PeerInfo)? + + @[JSON::Field(key: "metadata", emit_null: false)] + property metadata : Hash(String, JSON::Any)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@enabled : Bool, @status : ClusterStatusTelemetry? = nil, @config : ClusterConfigTelemetry? = nil, @peers : Hash(String, PeerInfo)? = nil, @metadata : Hash(String, JSON::Any)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(enabled, status, config, peers, metadata) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_cluster_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_cluster_info.cr new file mode 100644 index 000000000000..0cb89f13453f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_cluster_info.cr @@ -0,0 +1,73 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Current clustering distribution for the collection + class CollectionClusterInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # ID of this peer + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32 + + # Total number of shards + @[JSON::Field(key: "shard_count", emit_null: false)] + property shard_count : Int32 + + # Local shards + @[JSON::Field(key: "local_shards", emit_null: false)] + property local_shards : Array(LocalShardInfo) + + # Remote shards + @[JSON::Field(key: "remote_shards", emit_null: false)] + property remote_shards : Array(RemoteShardInfo) + + # Shard transfers + @[JSON::Field(key: "shard_transfers", emit_null: false)] + property shard_transfers : Array(ShardTransferInfo) + + # Optional properties + # Resharding operations + @[JSON::Field(key: "resharding_operations", emit_null: false)] + property resharding_operations : Array(ReshardingInfo)? + + validates(peer_id, Int32, false, minimum: 0) + validates(shard_count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@peer_id : Int32, @shard_count : Int32, @local_shards : Array(LocalShardInfo), @remote_shards : Array(RemoteShardInfo), @shard_transfers : Array(ShardTransferInfo), @resharding_operations : Array(ReshardingInfo)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + if (msg = shard_count_validation_error(@shard_count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(peer_id, shard_count, local_shards, remote_shards, shard_transfers, resharding_operations) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_cluster_info200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_cluster_info200_response.cr new file mode 100644 index 000000000000..ec3b22e9694b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_cluster_info200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionClusterInfo200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : CollectionClusterInfo? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : CollectionClusterInfo? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_config.cr new file mode 100644 index 000000000000..862fd1c0f9ca --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_config.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "params", emit_null: false)] + property params : CollectionParams + + @[JSON::Field(key: "hnsw_config", emit_null: false)] + property hnsw_config : HnswConfig + + @[JSON::Field(key: "optimizer_config", emit_null: false)] + property optimizer_config : OptimizersConfig + + @[JSON::Field(key: "wal_config", emit_null: false)] + property wal_config : WalConfig + + # Optional properties + @[JSON::Field(key: "quantization_config", emit_null: false)] + property quantization_config : QuantizationConfig? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@params : CollectionParams, @hnsw_config : HnswConfig, @optimizer_config : OptimizersConfig, @wal_config : WalConfig, @quantization_config : QuantizationConfig? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(params, hnsw_config, optimizer_config, wal_config, quantization_config) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_description.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_description.cr new file mode 100644 index 000000000000..c5e6f38e9854 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_description.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionDescription + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "name", emit_null: false)] + property name : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_existence.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_existence.cr new file mode 100644 index 000000000000..acb353a139c4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_existence.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # State of existence of a collection, true = exists, false = does not exist + class CollectionExistence + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "exists", emit_null: false)] + property exists : Bool + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@exists : Bool) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(exists) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_exists200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_exists200_response.cr new file mode 100644 index 000000000000..c148c30db764 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_exists200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionExists200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : CollectionExistence? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : CollectionExistence? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_info.cr new file mode 100644 index 000000000000..5bdf4a04e9cc --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_info.cr @@ -0,0 +1,86 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Current statistics and configuration of the collection + class CollectionInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "status", emit_null: false)] + property status : CollectionStatus + + @[JSON::Field(key: "optimizer_status", emit_null: false)] + property optimizer_status : OptimizersStatus + + # Number of segments in collection. Each segment has independent vector as payload indexes + @[JSON::Field(key: "segments_count", emit_null: false)] + property segments_count : Int32 + + @[JSON::Field(key: "config", emit_null: false)] + property config : CollectionConfig + + # Types of stored payload + @[JSON::Field(key: "payload_schema", emit_null: false)] + property payload_schema : Hash(String, PayloadIndexInfo) + + # Optional properties + # DEPRECATED: Approximate number of vectors in collection. All vectors in collection are available for querying. Calculated as `points_count x vectors_per_point`. Where `vectors_per_point` is a number of named vectors in schema. + @[JSON::Field(key: "vectors_count", emit_null: false)] + property vectors_count : Int32? + + # Approximate number of indexed vectors in the collection. Indexed vectors in large segments are faster to query, as it is stored in a specialized vector index. + @[JSON::Field(key: "indexed_vectors_count", emit_null: false)] + property indexed_vectors_count : Int32? + + # Approximate number of points (vectors + payloads) in collection. Each point could be accessed by unique id. + @[JSON::Field(key: "points_count", emit_null: false)] + property points_count : Int32? + + validates(vectors_count, Int32, true, minimum: 0) + validates(indexed_vectors_count, Int32, true, minimum: 0) + validates(points_count, Int32, true, minimum: 0) + validates(segments_count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@status : CollectionStatus, @optimizer_status : OptimizersStatus, @segments_count : Int32, @config : CollectionConfig, @payload_schema : Hash(String, PayloadIndexInfo), @vectors_count : Int32? = nil, @indexed_vectors_count : Int32? = nil, @points_count : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = vectors_count_validation_error(@vectors_count)) + invalid_properties.push(msg) + end + if (msg = indexed_vectors_count_validation_error(@indexed_vectors_count)) + invalid_properties.push(msg) + end + if (msg = points_count_validation_error(@points_count)) + invalid_properties.push(msg) + end + if (msg = segments_count_validation_error(@segments_count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(status, optimizer_status, vectors_count, indexed_vectors_count, points_count, segments_count, config, payload_schema) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_params.cr new file mode 100644 index 000000000000..35f35a68ec82 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_params.cr @@ -0,0 +1,86 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + @[JSON::Field(key: "vectors", emit_null: false)] + property vectors : VectorsConfig? + + # Number of shards the collection has + @[JSON::Field(key: "shard_number", emit_null: false)] + property shard_number : Int32? = 1 + + # Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key + @[JSON::Field(key: "sharding_method", emit_null: false)] + property sharding_method : ShardingMethod? + + # Number of replicas for each shard + @[JSON::Field(key: "replication_factor", emit_null: false)] + property replication_factor : Int32? = 1 + + # Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will make the collection more resilient to inconsistencies, but will also make it fail if not enough replicas are available. Does not have any performance impact. + @[JSON::Field(key: "write_consistency_factor", emit_null: false)] + property write_consistency_factor : Int32? = 1 + + # Defines how many additional replicas should be processing read request at the same time. Default value is Auto, which means that fan-out will be determined automatically based on the busyness of the local replica. Having more than 0 might be useful to smooth latency spikes of individual nodes. + @[JSON::Field(key: "read_fan_out_factor", emit_null: false)] + property read_fan_out_factor : Int32? + + # If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM. + @[JSON::Field(key: "on_disk_payload", emit_null: false)] + property on_disk_payload : Bool? = false + + # Configuration of the sparse vector storage + @[JSON::Field(key: "sparse_vectors", emit_null: false)] + property sparse_vectors : Hash(String, SparseVectorParams)? + + validates(shard_number, Int32, true, minimum: 1) + validates(replication_factor, Int32, true, minimum: 1) + validates(write_consistency_factor, Int32, true, minimum: 1) + validates(read_fan_out_factor, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vectors : VectorsConfig? = nil, @shard_number : Int32? = 1, @sharding_method : ShardingMethod? = nil, @replication_factor : Int32? = 1, @write_consistency_factor : Int32? = 1, @read_fan_out_factor : Int32? = nil, @on_disk_payload : Bool? = false, @sparse_vectors : Hash(String, SparseVectorParams)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_number_validation_error(@shard_number)) + invalid_properties.push(msg) + end + if (msg = replication_factor_validation_error(@replication_factor)) + invalid_properties.push(msg) + end + if (msg = write_consistency_factor_validation_error(@write_consistency_factor)) + invalid_properties.push(msg) + end + if (msg = read_fan_out_factor_validation_error(@read_fan_out_factor)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(vectors, shard_number, sharding_method, replication_factor, write_consistency_factor, read_fan_out_factor, on_disk_payload, sparse_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_params_diff.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_params_diff.cr new file mode 100644 index 000000000000..4889dc55c75b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_params_diff.cr @@ -0,0 +1,67 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionParamsDiff + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Number of replicas for each shard + @[JSON::Field(key: "replication_factor", emit_null: false)] + property replication_factor : Int32? + + # Minimal number successful responses from replicas to consider operation successful + @[JSON::Field(key: "write_consistency_factor", emit_null: false)] + property write_consistency_factor : Int32? + + # Fan-out every read request to these many additional remote nodes (and return first available response) + @[JSON::Field(key: "read_fan_out_factor", emit_null: false)] + property read_fan_out_factor : Int32? + + # If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM. + @[JSON::Field(key: "on_disk_payload", emit_null: false)] + property on_disk_payload : Bool? + + validates(replication_factor, Int32, true, minimum: 1) + validates(write_consistency_factor, Int32, true, minimum: 1) + validates(read_fan_out_factor, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@replication_factor : Int32? = nil, @write_consistency_factor : Int32? = nil, @read_fan_out_factor : Int32? = nil, @on_disk_payload : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = replication_factor_validation_error(@replication_factor)) + invalid_properties.push(msg) + end + if (msg = write_consistency_factor_validation_error(@write_consistency_factor)) + invalid_properties.push(msg) + end + if (msg = read_fan_out_factor_validation_error(@read_fan_out_factor)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(replication_factor, write_consistency_factor, read_fan_out_factor, on_disk_payload) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_status.cr new file mode 100644 index 000000000000..a0d6606e81b8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_status.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # CollectionStatus (OpenAPI enum). Allowed values: "green", "yellow", "grey", "red". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias CollectionStatus = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_telemetry.cr new file mode 100644 index 000000000000..6d3cfe854cd4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_telemetry.cr @@ -0,0 +1,61 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : String + + @[JSON::Field(key: "init_time_ms", emit_null: false)] + property init_time_ms : Int32 + + @[JSON::Field(key: "config", emit_null: false)] + property config : CollectionConfig + + @[JSON::Field(key: "shards", emit_null: false)] + property shards : Array(ReplicaSetTelemetry) + + @[JSON::Field(key: "transfers", emit_null: false)] + property transfers : Array(ShardTransferInfo) + + @[JSON::Field(key: "resharding", emit_null: false)] + property resharding : Array(ReshardingInfo) + + validates(init_time_ms, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : String, @init_time_ms : Int32, @config : CollectionConfig, @shards : Array(ReplicaSetTelemetry), @transfers : Array(ShardTransferInfo), @resharding : Array(ReshardingInfo)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = init_time_ms_validation_error(@init_time_ms)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, init_time_ms, config, shards, transfers, resharding) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_telemetry_enum.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_telemetry_enum.cr new file mode 100644 index 000000000000..cab5e5c798a6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collection_telemetry_enum.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # CollectionTelemetryEnum (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class CollectionTelemetryEnum + getter value + + def initialize(@value : CollectionTelemetry) + end + def initialize(@value : CollectionsAggregatedTelemetry) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + CollectionTelemetry, CollectionsAggregatedTelemetry + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(CollectionTelemetry.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(CollectionsAggregatedTelemetry.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in CollectionTelemetryEnum (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(CollectionTelemetry.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(CollectionsAggregatedTelemetry.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in CollectionTelemetryEnum (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_aggregated_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_aggregated_telemetry.cr new file mode 100644 index 000000000000..52e8d320ed51 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_aggregated_telemetry.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionsAggregatedTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "vectors", emit_null: false)] + property vectors : Int32 + + @[JSON::Field(key: "optimizers_status", emit_null: false)] + property optimizers_status : OptimizersStatus + + @[JSON::Field(key: "params", emit_null: false)] + property params : CollectionParams + + validates(vectors, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vectors : Int32, @optimizers_status : OptimizersStatus, @params : CollectionParams) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = vectors_validation_error(@vectors)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(vectors, optimizers_status, params) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_aliases_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_aliases_response.cr new file mode 100644 index 000000000000..73660b66a00b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_aliases_response.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionsAliasesResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "aliases", emit_null: false)] + property aliases : Array(AliasDescription) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@aliases : Array(AliasDescription)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(aliases) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_response.cr new file mode 100644 index 000000000000..32aa28baca1f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_response.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionsResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "collections", emit_null: false)] + property collections : Array(CollectionDescription) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@collections : Array(CollectionDescription)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(collections) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_telemetry.cr new file mode 100644 index 000000000000..9dc1e56cd352 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/collections_telemetry.cr @@ -0,0 +1,50 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CollectionsTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "number_of_collections", emit_null: false)] + property number_of_collections : Int32 + + # Optional properties + @[JSON::Field(key: "collections", emit_null: false)] + property collections : Array(CollectionTelemetryEnum)? + + validates(number_of_collections, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@number_of_collections : Int32, @collections : Array(CollectionTelemetryEnum)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = number_of_collections_validation_error(@number_of_collections)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(number_of_collections, collections) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/compression_ratio.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/compression_ratio.cr new file mode 100644 index 000000000000..e9d1a824ef39 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/compression_ratio.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # CompressionRatio (OpenAPI enum). Allowed values: "x4", "x8", "x16", "x32", "x64". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias CompressionRatio = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/condition.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/condition.cr new file mode 100644 index 000000000000..1a070c14ce41 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/condition.cr @@ -0,0 +1,110 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Condition (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class Condition + getter value + + def initialize(@value : FieldCondition) + end + def initialize(@value : Filter) + end + def initialize(@value : HasIdCondition) + end + def initialize(@value : IsEmptyCondition) + end + def initialize(@value : IsNullCondition) + end + def initialize(@value : NestedCondition) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + FieldCondition, Filter, HasIdCondition, IsEmptyCondition, IsNullCondition, NestedCondition + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(FieldCondition.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Filter.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(HasIdCondition.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(IsEmptyCondition.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(IsNullCondition.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(NestedCondition.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in Condition (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(FieldCondition.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Filter.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(HasIdCondition.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(IsEmptyCondition.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(IsNullCondition.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(NestedCondition.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in Condition (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_config_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_config_telemetry.cr new file mode 100644 index 000000000000..7670a26dc367 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_config_telemetry.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ConsensusConfigTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "max_message_queue_size", emit_null: false)] + property max_message_queue_size : Int32 + + @[JSON::Field(key: "tick_period_ms", emit_null: false)] + property tick_period_ms : Int32 + + @[JSON::Field(key: "bootstrap_timeout_sec", emit_null: false)] + property bootstrap_timeout_sec : Int32 + + validates(max_message_queue_size, Int32, false, minimum: 0) + validates(tick_period_ms, Int32, false, minimum: 0) + validates(bootstrap_timeout_sec, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@max_message_queue_size : Int32, @tick_period_ms : Int32, @bootstrap_timeout_sec : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = max_message_queue_size_validation_error(@max_message_queue_size)) + invalid_properties.push(msg) + end + if (msg = tick_period_ms_validation_error(@tick_period_ms)) + invalid_properties.push(msg) + end + if (msg = bootstrap_timeout_sec_validation_error(@bootstrap_timeout_sec)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(max_message_queue_size, tick_period_ms, bootstrap_timeout_sec) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status.cr new file mode 100644 index 000000000000..33579e3d9937 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status.cr @@ -0,0 +1,90 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Information about current consensus thread status + # ConsensusThreadStatus (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. + class ConsensusThreadStatus + getter value + + def initialize(@value : ConsensusThreadStatusOneOf) + end + def initialize(@value : ConsensusThreadStatusOneOf1) + end + def initialize(@value : ConsensusThreadStatusOneOf2) + end + + # List of classes defined in oneOf (OpenAPI v3) + def self.openapi_one_of + [ + ConsensusThreadStatusOneOf, ConsensusThreadStatusOneOf1, ConsensusThreadStatusOneOf2 + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(ConsensusThreadStatusOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ConsensusThreadStatusOneOf1.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ConsensusThreadStatusOneOf2.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ConsensusThreadStatus (oneOf)", 0, 0) + end + + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(ConsensusThreadStatusOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ConsensusThreadStatusOneOf1.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ConsensusThreadStatusOneOf2.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ConsensusThreadStatus (oneOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of.cr new file mode 100644 index 000000000000..2818e2aea0d5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ConsensusThreadStatusOneOf + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "consensus_thread_status", emit_null: false)] + property consensus_thread_status : String + + @[JSON::Field(key: "last_update", emit_null: false)] + property last_update : Time + + validates(consensus_thread_status, String, false, enum: ["working"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@consensus_thread_status : String, @last_update : Time) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = consensus_thread_status_validation_error(@consensus_thread_status)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(consensus_thread_status, last_update) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of1.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of1.cr new file mode 100644 index 000000000000..6ee298faa984 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of1.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ConsensusThreadStatusOneOf1 + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "consensus_thread_status", emit_null: false)] + property consensus_thread_status : String + + validates(consensus_thread_status, String, false, enum: ["stopped"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@consensus_thread_status : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = consensus_thread_status_validation_error(@consensus_thread_status)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(consensus_thread_status) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of2.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of2.cr new file mode 100644 index 000000000000..f10581df6074 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/consensus_thread_status_one_of2.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ConsensusThreadStatusOneOf2 + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "consensus_thread_status", emit_null: false)] + property consensus_thread_status : String + + @[JSON::Field(key: "err", emit_null: false)] + property err : String + + validates(consensus_thread_status, String, false, enum: ["stopped_with_err"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@consensus_thread_status : String, @err : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = consensus_thread_status_validation_error(@consensus_thread_status)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(consensus_thread_status, err) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_example_pair.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_example_pair.cr new file mode 100644 index 000000000000..5f3f284ada4e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_example_pair.cr @@ -0,0 +1,45 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ContextExamplePair + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "positive", emit_null: false)] + property positive : RecommendExample + + @[JSON::Field(key: "negative", emit_null: false)] + property negative : RecommendExample + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@positive : RecommendExample, @negative : RecommendExample) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(positive, negative) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_input.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_input.cr new file mode 100644 index 000000000000..baa743272bec --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_input.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ContextInput (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ContextInput + getter value + + def initialize(@value : Array(ContextPair)) + end + def initialize(@value : ContextPair) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(ContextPair), ContextPair + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(ContextPair).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ContextPair.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ContextInput (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(ContextPair).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ContextPair.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ContextInput (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_pair.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_pair.cr new file mode 100644 index 000000000000..c117b2da3481 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_pair.cr @@ -0,0 +1,45 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ContextPair + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "positive", emit_null: false)] + property positive : VectorInput + + @[JSON::Field(key: "negative", emit_null: false)] + property negative : VectorInput + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@positive : VectorInput, @negative : VectorInput) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(positive, negative) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_query.cr new file mode 100644 index 000000000000..8f464011c273 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/context_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ContextQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "context", emit_null: false)] + property context : ContextInput + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@context : ContextInput) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(context) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_points200_response.cr new file mode 100644 index 000000000000..7251934cc169 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CountPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : CountResult? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : CountResult? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_request.cr new file mode 100644 index 000000000000..1afaf074548e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_request.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Count Request Counts the number of points which satisfy the given filter. If filter is not provided, the count of all points in the collection will be returned. + class CountRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # If true, count exact number of points. If false, count approximate number of points faster. Approximate count might be unreliable during the indexing process. Default: true + @[JSON::Field(key: "exact", emit_null: false)] + property exact : Bool? = true + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_key : ShardKeySelector? = nil, @filter : Filter? = nil, @exact : Bool? = true) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, filter, exact) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_result.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_result.cr new file mode 100644 index 000000000000..cc7feae053ba --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/count_result.cr @@ -0,0 +1,47 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CountResult + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Number of points which satisfy the conditions + @[JSON::Field(key: "count", emit_null: false)] + property count : Int32 + + validates(count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@count : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = count_validation_error(@count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(count) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_alias.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_alias.cr new file mode 100644 index 000000000000..da23a8980a8b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_alias.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Create alternative name for a collection. Collection will be available under both names for search, retrieve, + class CreateAlias + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "collection_name", emit_null: false)] + property collection_name : String + + @[JSON::Field(key: "alias_name", emit_null: false)] + property alias_name : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@collection_name : String, @alias_name : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(collection_name, alias_name) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_alias_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_alias_operation.cr new file mode 100644 index 000000000000..b84b0fcd94cc --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_alias_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateAliasOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "create_alias", emit_null: false)] + property create_alias : CreateAlias + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@create_alias : CreateAlias) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(create_alias) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_collection.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_collection.cr new file mode 100644 index 000000000000..9ff830813349 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_collection.cr @@ -0,0 +1,99 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Operation for creating new collection and (optionally) specify index params + class CreateCollection + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + @[JSON::Field(key: "vectors", emit_null: false)] + property vectors : VectorsConfig? + + # For auto sharding: Number of shards in collection. - Default is 1 for standalone, otherwise equal to the number of nodes - Minimum is 1 For custom sharding: Number of shards in collection per shard group. - Default is 1, meaning that each shard key will be mapped to a single shard - Minimum is 1 + @[JSON::Field(key: "shard_number", emit_null: false)] + property shard_number : Int32? + + # Sharding method Default is Auto - points are distributed across all available shards Custom - points are distributed across shards according to shard key + @[JSON::Field(key: "sharding_method", emit_null: false)] + property sharding_method : ShardingMethod? + + # Number of shards replicas. Default is 1 Minimum is 1 + @[JSON::Field(key: "replication_factor", emit_null: false)] + property replication_factor : Int32? + + # Defines how many replicas should apply the operation for us to consider it successful. Increasing this number will make the collection more resilient to inconsistencies, but will also make it fail if not enough replicas are available. Does not have any performance impact. + @[JSON::Field(key: "write_consistency_factor", emit_null: false)] + property write_consistency_factor : Int32? + + # If true - point's payload will not be stored in memory. It will be read from the disk every time it is requested. This setting saves RAM by (slightly) increasing the response time. Note: those payload values that are involved in filtering and are indexed - remain in RAM. + @[JSON::Field(key: "on_disk_payload", emit_null: false)] + property on_disk_payload : Bool? + + # Custom params for HNSW index. If none - values from service configuration file are used. + @[JSON::Field(key: "hnsw_config", emit_null: false)] + property hnsw_config : HnswConfigDiff? + + # Custom params for WAL. If none - values from service configuration file are used. + @[JSON::Field(key: "wal_config", emit_null: false)] + property wal_config : WalConfigDiff? + + # Custom params for Optimizers. If none - values from service configuration file are used. + @[JSON::Field(key: "optimizers_config", emit_null: false)] + property optimizers_config : OptimizersConfigDiff? + + # Specify other collection to copy data from. + @[JSON::Field(key: "init_from", emit_null: false)] + property init_from : InitFrom? + + # Quantization parameters. If none - quantization is disabled. + @[JSON::Field(key: "quantization_config", emit_null: false)] + property quantization_config : QuantizationConfig? + + # Sparse vector data config. + @[JSON::Field(key: "sparse_vectors", emit_null: false)] + property sparse_vectors : Hash(String, SparseVectorParams)? + + validates(shard_number, Int32, true, minimum: 1) + validates(replication_factor, Int32, true, minimum: 1) + validates(write_consistency_factor, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vectors : VectorsConfig? = nil, @shard_number : Int32? = nil, @sharding_method : ShardingMethod? = nil, @replication_factor : Int32? = nil, @write_consistency_factor : Int32? = nil, @on_disk_payload : Bool? = nil, @hnsw_config : HnswConfigDiff? = nil, @wal_config : WalConfigDiff? = nil, @optimizers_config : OptimizersConfigDiff? = nil, @init_from : InitFrom? = nil, @quantization_config : QuantizationConfig? = nil, @sparse_vectors : Hash(String, SparseVectorParams)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_number_validation_error(@shard_number)) + invalid_properties.push(msg) + end + if (msg = replication_factor_validation_error(@replication_factor)) + invalid_properties.push(msg) + end + if (msg = write_consistency_factor_validation_error(@write_consistency_factor)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(vectors, shard_number, sharding_method, replication_factor, write_consistency_factor, on_disk_payload, hnsw_config, wal_config, optimizers_config, init_from, quantization_config, sparse_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_field_index.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_field_index.cr new file mode 100644 index 000000000000..a1bdf7947419 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_field_index.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateFieldIndex + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "field_name", emit_null: false)] + property field_name : String + + # Optional properties + @[JSON::Field(key: "field_schema", emit_null: false)] + property field_schema : PayloadFieldSchema? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@field_name : String, @field_schema : PayloadFieldSchema? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(field_name, field_schema) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_field_index200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_field_index200_response.cr new file mode 100644 index 000000000000..055c932d6a1d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_field_index200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateFieldIndex200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : UpdateResult? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : UpdateResult? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_shard_key200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_shard_key200_response.cr new file mode 100644 index 000000000000..b80ea0f81c9a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_shard_key200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateShardKey200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_sharding_key.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_sharding_key.cr new file mode 100644 index 000000000000..fde1414de653 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_sharding_key.cr @@ -0,0 +1,63 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateShardingKey + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey + + # Optional properties + # How many shards to create for this key If not specified, will use the default value from config + @[JSON::Field(key: "shards_number", emit_null: false)] + property shards_number : Int32? + + # How many replicas to create for each shard If not specified, will use the default value from config + @[JSON::Field(key: "replication_factor", emit_null: false)] + property replication_factor : Int32? + + # Placement of shards for this key List of peer ids, that can be used to place shards for this key If not specified, will be randomly placed among all peers + @[JSON::Field(key: "placement", emit_null: false)] + property placement : Array(Int32)? + + validates(shards_number, Int32, true, minimum: 1) + validates(replication_factor, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_key : ShardKey, @shards_number : Int32? = nil, @replication_factor : Int32? = nil, @placement : Array(Int32)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shards_number_validation_error(@shards_number)) + invalid_properties.push(msg) + end + if (msg = replication_factor_validation_error(@replication_factor)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, shards_number, replication_factor, placement) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_sharding_key_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_sharding_key_operation.cr new file mode 100644 index 000000000000..c1ef595af320 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_sharding_key_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateShardingKeyOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "create_sharding_key", emit_null: false)] + property create_sharding_key : CreateShardingKey + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@create_sharding_key : CreateShardingKey) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(create_sharding_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_snapshot200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_snapshot200_response.cr new file mode 100644 index 000000000000..e3cd57bf9b49 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/create_snapshot200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class CreateSnapshot200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : SnapshotDescription? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : SnapshotDescription? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/datatype.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datatype.cr new file mode 100644 index 000000000000..1a43d83a80e7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datatype.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Datatype (OpenAPI enum). Allowed values: "float32", "uint8", "float16". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Datatype = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_index_params.cr new file mode 100644 index 000000000000..cba80a213ce7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_index_params.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DatetimeIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : DatetimeIndexType + + # Optional properties + # If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests. + @[JSON::Field(key: "is_principal", emit_null: false)] + property is_principal : Bool? + + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : DatetimeIndexType, @is_principal : Bool? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, is_principal, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_index_type.cr new file mode 100644 index 000000000000..3fad223021b0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # DatetimeIndexType (OpenAPI enum). Allowed values: "datetime". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias DatetimeIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_range.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_range.cr new file mode 100644 index 000000000000..b333218a165e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/datetime_range.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Range filter request + class DatetimeRange + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # point.key < range.lt + @[JSON::Field(key: "lt", emit_null: false)] + property lt : Time? + + # point.key > range.gt + @[JSON::Field(key: "gt", emit_null: false)] + property gt : Time? + + # point.key >= range.gte + @[JSON::Field(key: "gte", emit_null: false)] + property gte : Time? + + # point.key <= range.lte + @[JSON::Field(key: "lte", emit_null: false)] + property lte : Time? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@lt : Time? = nil, @gt : Time? = nil, @gte : Time? = nil, @lte : Time? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(lt, gt, gte, lte) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_alias.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_alias.cr new file mode 100644 index 000000000000..f797a9a6abbd --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_alias.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Delete alias if exists + class DeleteAlias + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "alias_name", emit_null: false)] + property alias_name : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@alias_name : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(alias_name) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_alias_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_alias_operation.cr new file mode 100644 index 000000000000..9dbac0bafb03 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_alias_operation.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Delete alias if exists + class DeleteAliasOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "delete_alias", emit_null: false)] + property delete_alias : DeleteAlias + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@delete_alias : DeleteAlias) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(delete_alias) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_operation.cr new file mode 100644 index 000000000000..e4036f521f03 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DeleteOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "delete", emit_null: false)] + property delete : PointsSelector + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@delete : PointsSelector) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(delete) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_payload.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_payload.cr new file mode 100644 index 000000000000..32061f26584b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_payload.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # This data structure is used in API interface and applied across multiple shards + class DeletePayload + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # List of payload keys to remove from payload + @[JSON::Field(key: "keys", emit_null: false)] + property keys : Array(String) + + # Optional properties + # Deletes values from each point in this list + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(ExtendedPointId)? + + # Deletes values from points that satisfy this filter condition + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@keys : Array(String), @points : Array(ExtendedPointId)? = nil, @filter : Filter? = nil, @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(keys, points, filter, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_payload_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_payload_operation.cr new file mode 100644 index 000000000000..fbc4dfa8f9d1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_payload_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DeletePayloadOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "delete_payload", emit_null: false)] + property delete_payload : DeletePayload + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@delete_payload : DeletePayload) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(delete_payload) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_vectors.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_vectors.cr new file mode 100644 index 000000000000..a95a5c659981 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_vectors.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DeleteVectors + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Vector names + @[JSON::Field(key: "vector", emit_null: false)] + property vector : Set(String) + + # Optional properties + # Deletes values from each point in this list + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(ExtendedPointId)? + + # Deletes values from points that satisfy this filter condition + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vector : Set(String), @points : Array(ExtendedPointId)? = nil, @filter : Filter? = nil, @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points, filter, vector, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_vectors_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_vectors_operation.cr new file mode 100644 index 000000000000..6947cd4d573c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/delete_vectors_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DeleteVectorsOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "delete_vectors", emit_null: false)] + property delete_vectors : DeleteVectors + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@delete_vectors : DeleteVectors) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(delete_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/direction.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/direction.cr new file mode 100644 index 000000000000..50bfea8802e2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/direction.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Direction (OpenAPI enum). Allowed values: "asc", "desc". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Direction = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/disabled.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/disabled.cr new file mode 100644 index 000000000000..dad1b2385ca5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/disabled.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Disabled (OpenAPI enum). Allowed values: "Disabled". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Disabled = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_input.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_input.cr new file mode 100644 index 000000000000..08884d011a93 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_input.cr @@ -0,0 +1,45 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DiscoverInput + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "target", emit_null: false)] + property target : VectorInput + + @[JSON::Field(key: "context", emit_null: false)] + property context : DiscoverInputContext + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@target : VectorInput, @context : DiscoverInputContext) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(target, context) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_input_context.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_input_context.cr new file mode 100644 index 000000000000..5619fd166324 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_input_context.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Search space will be constrained by these pairs of vectors + # DiscoverInputContext (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class DiscoverInputContext + getter value + + def initialize(@value : Array(ContextPair)) + end + def initialize(@value : ContextPair) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(ContextPair), ContextPair + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(ContextPair).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ContextPair.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in DiscoverInputContext (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(ContextPair).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ContextPair.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in DiscoverInputContext (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_query.cr new file mode 100644 index 000000000000..0d2c80570915 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DiscoverQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "discover", emit_null: false)] + property discover : DiscoverInput + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@discover : DiscoverInput) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(discover) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_request.cr new file mode 100644 index 000000000000..93f66ed0a49e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_request.cr @@ -0,0 +1,93 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Use context and a target to find the most similar points, constrained by the context. + class DiscoverRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Max number of result to return + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32 + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look for vectors closest to this. When using the target (with or without context), the integer part of the score represents the rank with respect to the context, while the decimal part of the score relates to the distance to the target. + @[JSON::Field(key: "target", emit_null: false)] + property target : RecommendExample? + + # Pairs of { positive, negative } examples to constrain the search. When using only the context (without a target), a special search - called context search - is performed where pairs of points are used to generate a loss that guides the search towards the zone where most positive examples overlap. This means that the score minimizes the scenario of finding a point closer to a negative than to a positive part of a pair. Since the score of a context relates to loss, the maximum score a point can get is 0.0, and it becomes normal that many points can have a score of 0.0. For discovery search (when including a target), the context part of the score for each pair is calculated +1 if the point is closer to a positive than to a negative part of a pair, and -1 otherwise. + @[JSON::Field(key: "context", emit_null: false)] + property context : Array(ContextExamplePair)? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Additional search params + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues. + @[JSON::Field(key: "offset", emit_null: false)] + property offset : Int32? + + # Select which payload to return with the response. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # Options for specifying which vectors to include into response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Define which vector to use for recommendation, if not specified - try to use default vector + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + # The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection + @[JSON::Field(key: "lookup_from", emit_null: false)] + property lookup_from : LookupLocation? + + validates(limit, Int32, false, minimum: 1) + validates(offset, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@limit : Int32, @shard_key : ShardKeySelector? = nil, @target : RecommendExample? = nil, @context : Array(ContextExamplePair)? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @offset : Int32? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil, @using : String? = nil, @lookup_from : LookupLocation? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + if (msg = offset_validation_error(@offset)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, target, context, filter, params, limit, offset, with_payload, with_vector, using, lookup_from) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_request_batch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_request_batch.cr new file mode 100644 index 000000000000..0cf6d888e38f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/discover_request_batch.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DiscoverRequestBatch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "searches", emit_null: false)] + property searches : Array(DiscoverRequest) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@searches : Array(DiscoverRequest)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(searches) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/distance.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/distance.cr new file mode 100644 index 000000000000..820cb24874ea --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/distance.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Distance (OpenAPI enum). Allowed values: "Cosine", "Euclid", "Dot", "Manhattan". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Distance = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/document.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/document.cr new file mode 100644 index 000000000000..5ac8f6976b71 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/document.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # WARN: Work-in-progress, unimplemented Text document for embedding. Requires inference infrastructure, unimplemented. + class Document + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Text of the document This field will be used as input for the embedding model + @[JSON::Field(key: "text", emit_null: false)] + property text : String + + # Optional properties + # Name of the model used to generate the vector List of available models depends on a provider + @[JSON::Field(key: "model", emit_null: false)] + property model : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@text : String, @model : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(text, model) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_replica_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_replica_operation.cr new file mode 100644 index 000000000000..f742ea0d6b59 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_replica_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DropReplicaOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "drop_replica", emit_null: false)] + property drop_replica : Replica + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@drop_replica : Replica) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(drop_replica) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_sharding_key.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_sharding_key.cr new file mode 100644 index 000000000000..b8547f2de442 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_sharding_key.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DropShardingKey + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_key : ShardKey) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_sharding_key_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_sharding_key_operation.cr new file mode 100644 index 000000000000..16b70c6dbb5e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/drop_sharding_key_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class DropShardingKeyOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "drop_sharding_key", emit_null: false)] + property drop_sharding_key : DropShardingKey + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@drop_sharding_key : DropShardingKey) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(drop_sharding_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/error_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/error_response.cr new file mode 100644 index 000000000000..b980bbc0977a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/error_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ErrorResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : ErrorResponseStatus? + + @[JSON::Field(key: "result", emit_null: false)] + property result : JSON::Any? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : ErrorResponseStatus? = nil, @result : JSON::Any? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/error_response_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/error_response_status.cr new file mode 100644 index 000000000000..b2b2e3465b5f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/error_response_status.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ErrorResponseStatus + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Description of the occurred error. + @[JSON::Field(key: "error", emit_null: false)] + property error : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@error : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(error) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/extended_point_id.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/extended_point_id.cr new file mode 100644 index 000000000000..a9e5344832f6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/extended_point_id.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Type, used for specifying point ID in user interface + # ExtendedPointId (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ExtendedPointId + getter value + + def initialize(@value : Int32) + end + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Int32, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Int32.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ExtendedPointId (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Int32.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ExtendedPointId (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet200_response.cr new file mode 100644 index 000000000000..e4664fc7f299 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Facet200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : FacetResponse? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : FacetResponse? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_request.cr new file mode 100644 index 000000000000..bc1d938e1494 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_request.cr @@ -0,0 +1,63 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class FacetRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Payload key to use for faceting. + @[JSON::Field(key: "key", emit_null: false)] + property key : String + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Max number of hits to return. Default is 10. + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32? + + # Filter conditions - only consider points that satisfy these conditions. + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Whether to do a more expensive exact count for each of the values in the facet. Default is false. + @[JSON::Field(key: "exact", emit_null: false)] + property exact : Bool? + + validates(limit, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@key : String, @shard_key : ShardKeySelector? = nil, @limit : Int32? = nil, @filter : Filter? = nil, @exact : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, key, limit, filter, exact) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_response.cr new file mode 100644 index 000000000000..4181945ac812 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_response.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class FacetResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "hits", emit_null: false)] + property hits : Array(FacetValueHit) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@hits : Array(FacetValueHit)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(hits) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_value.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_value.cr new file mode 100644 index 000000000000..69ba1cadf1ef --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_value.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # FacetValue (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class FacetValue + getter value + + def initialize(@value : Bool) + end + def initialize(@value : Int64) + end + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Bool, Int64, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Bool.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in FacetValue (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Bool.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in FacetValue (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_value_hit.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_value_hit.cr new file mode 100644 index 000000000000..8bb936032c0e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/facet_value_hit.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class FacetValueHit + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "value", emit_null: false)] + property value : FacetValue + + @[JSON::Field(key: "count", emit_null: false)] + property count : Int32 + + validates(count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@value : FacetValue, @count : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = count_validation_error(@count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(value, count) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/field_condition.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/field_condition.cr new file mode 100644 index 000000000000..92598c559461 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/field_condition.cr @@ -0,0 +1,69 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # All possible payload filtering conditions + class FieldCondition + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Payload key + @[JSON::Field(key: "key", emit_null: false)] + property key : String + + # Optional properties + # Check if point has field with a given value + @[JSON::Field(key: "match", emit_null: false)] + property match : Match? + + # Check if points value lies in a given range + @[JSON::Field(key: "range", emit_null: false)] + property range : RangeInterface? + + # Check if points geo location lies in a given area + @[JSON::Field(key: "geo_bounding_box", emit_null: false)] + property geo_bounding_box : GeoBoundingBox? + + # Check if geo point is within a given radius + @[JSON::Field(key: "geo_radius", emit_null: false)] + property geo_radius : GeoRadius? + + # Check if geo point is within a given polygon + @[JSON::Field(key: "geo_polygon", emit_null: false)] + property geo_polygon : GeoPolygon? + + # Check number of values of the field + @[JSON::Field(key: "values_count", emit_null: false)] + property values_count : ValuesCount? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@key : String, @match : Match? = nil, @range : RangeInterface? = nil, @geo_bounding_box : GeoBoundingBox? = nil, @geo_radius : GeoRadius? = nil, @geo_polygon : GeoPolygon? = nil, @values_count : ValuesCount? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(key, match, range, geo_bounding_box, geo_radius, geo_polygon, values_count) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter.cr new file mode 100644 index 000000000000..eb74aab6139d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Filter + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + @[JSON::Field(key: "should", emit_null: false)] + property should : FilterShould? + + # At least minimum amount of given conditions should match + @[JSON::Field(key: "min_should", emit_null: false)] + property min_should : MinShould? + + @[JSON::Field(key: "must", emit_null: false)] + property must : FilterShould? + + @[JSON::Field(key: "must_not", emit_null: false)] + property must_not : FilterShould? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@should : FilterShould? = nil, @min_should : MinShould? = nil, @must : FilterShould? = nil, @must_not : FilterShould? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(should, min_should, must, must_not) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter_selector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter_selector.cr new file mode 100644 index 000000000000..20d715d967da --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter_selector.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class FilterSelector + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@filter : Filter, @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(filter, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter_should.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter_should.cr new file mode 100644 index 000000000000..0b519f430e21 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/filter_should.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # At least one of those conditions should match + # FilterShould (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class FilterShould + getter value + + def initialize(@value : Array(Condition)) + end + def initialize(@value : Condition) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Condition), Condition + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Condition).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Condition.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in FilterShould (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Condition).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Condition.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in FilterShould (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/float_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/float_index_params.cr new file mode 100644 index 000000000000..e99aff5bc794 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/float_index_params.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class FloatIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : FloatIndexType + + # Optional properties + # If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests. + @[JSON::Field(key: "is_principal", emit_null: false)] + property is_principal : Bool? + + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : FloatIndexType, @is_principal : Bool? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, is_principal, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/float_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/float_index_type.cr new file mode 100644 index 000000000000..8e5340bb7ed9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/float_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # FloatIndexType (OpenAPI enum). Allowed values: "float". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias FloatIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/fusion.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/fusion.cr new file mode 100644 index 000000000000..c83104e85a9f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/fusion.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Fusion (OpenAPI enum). Allowed values: "rrf", "dbsf". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Fusion = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/fusion_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/fusion_query.cr new file mode 100644 index 000000000000..5436859459ae --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/fusion_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class FusionQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "fusion", emit_null: false)] + property fusion : Fusion + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@fusion : Fusion) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(fusion) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_bounding_box.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_bounding_box.cr new file mode 100644 index 000000000000..2c246b187f3b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_bounding_box.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Geo filter request Matches coordinates inside the rectangle, described by coordinates of lop-left and bottom-right edges + class GeoBoundingBox + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "top_left", emit_null: false)] + property top_left : GeoPoint + + @[JSON::Field(key: "bottom_right", emit_null: false)] + property bottom_right : GeoPoint + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@top_left : GeoPoint, @bottom_right : GeoPoint) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(top_left, bottom_right) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_index_params.cr new file mode 100644 index 000000000000..60183074671e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_index_params.cr @@ -0,0 +1,47 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GeoIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : GeoIndexType + + # Optional properties + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : GeoIndexType, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_index_type.cr new file mode 100644 index 000000000000..fafe11387587 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # GeoIndexType (OpenAPI enum). Allowed values: "geo". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias GeoIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_line_string.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_line_string.cr new file mode 100644 index 000000000000..ed9b3fb9ac51 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_line_string.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Ordered sequence of GeoPoints representing the line + class GeoLineString + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(GeoPoint) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points : Array(GeoPoint)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_point.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_point.cr new file mode 100644 index 000000000000..7a2e670bc6c9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_point.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Geo point payload schema + class GeoPoint + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "lon", emit_null: false)] + property lon : Float64 + + @[JSON::Field(key: "lat", emit_null: false)] + property lat : Float64 + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@lon : Float64, @lat : Float64) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(lon, lat) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_polygon.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_polygon.cr new file mode 100644 index 000000000000..da56821cbf99 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_polygon.cr @@ -0,0 +1,48 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Geo filter request Matches coordinates inside the polygon, defined by `exterior` and `interiors` + class GeoPolygon + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "exterior", emit_null: false)] + property exterior : GeoLineString + + # Optional properties + # Interior lines (if present) bound holes within the surface each GeoLineString must consist of a minimum of 4 points, and the first and last points must be the same. + @[JSON::Field(key: "interiors", emit_null: false)] + property interiors : Array(GeoLineString)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@exterior : GeoLineString, @interiors : Array(GeoLineString)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(exterior, interiors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_radius.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_radius.cr new file mode 100644 index 000000000000..b55e46173108 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/geo_radius.cr @@ -0,0 +1,47 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Geo filter request Matches coordinates inside the circle of `radius` and center with coordinates `center` + class GeoRadius + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "center", emit_null: false)] + property center : GeoPoint + + # Radius of the area in meters + @[JSON::Field(key: "radius", emit_null: false)] + property radius : Float64 + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@center : GeoPoint, @radius : Float64) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(center, radius) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collection200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collection200_response.cr new file mode 100644 index 000000000000..e4e5c6194cfd --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collection200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GetCollection200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : CollectionInfo? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : CollectionInfo? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collection_aliases200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collection_aliases200_response.cr new file mode 100644 index 000000000000..5ae5d66786c0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collection_aliases200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GetCollectionAliases200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : CollectionsAliasesResponse? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : CollectionsAliasesResponse? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collections200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collections200_response.cr new file mode 100644 index 000000000000..60e0aab3f34f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_collections200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GetCollections200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : CollectionsResponse? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : CollectionsResponse? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_locks200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_locks200_response.cr new file mode 100644 index 000000000000..41e089a30f70 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_locks200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GetLocks200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : LocksOption? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : LocksOption? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_point200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_point200_response.cr new file mode 100644 index 000000000000..ee5474781407 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_point200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GetPoint200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Record? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Record? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_points200_response.cr new file mode 100644 index 000000000000..490532642c4b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/get_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GetPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Array(Record)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Array(Record)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/group_id.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/group_id.cr new file mode 100644 index 000000000000..b2dc069e1e36 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/group_id.cr @@ -0,0 +1,81 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Value of the group_by key, shared across all the hits in the group + # GroupId (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class GroupId + getter value + + def initialize(@value : Int32) + end + def initialize(@value : Int64) + end + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Int32, Int64, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Int32.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in GroupId (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Int32.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in GroupId (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/groups_result.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/groups_result.cr new file mode 100644 index 000000000000..c875d7cfa69e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/groups_result.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GroupsResult + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "groups", emit_null: false)] + property groups : Array(PointGroup) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@groups : Array(PointGroup)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(groups) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/grpc_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/grpc_telemetry.cr new file mode 100644 index 000000000000..bae815696818 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/grpc_telemetry.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class GrpcTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "responses", emit_null: false)] + property responses : Hash(String, OperationDurationStatistics) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@responses : Hash(String, OperationDurationStatistics)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(responses) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/has_id_condition.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/has_id_condition.cr new file mode 100644 index 000000000000..94e41196cbc5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/has_id_condition.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ID-based filtering condition + class HasIdCondition + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "has_id", emit_null: false)] + property has_id : Set(ExtendedPointId) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@has_id : Set(ExtendedPointId)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(has_id) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/hnsw_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/hnsw_config.cr new file mode 100644 index 000000000000..05df05c08b6f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/hnsw_config.cr @@ -0,0 +1,85 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Config of HNSW index + class HnswConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Number of edges per node in the index graph. Larger the value - more accurate the search, more space required. + @[JSON::Field(key: "m", emit_null: false)] + property m : Int32 + + # Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build index. + @[JSON::Field(key: "ef_construct", emit_null: false)] + property ef_construct : Int32 + + # Minimal size (in KiloBytes) of vectors for additional payload-based indexing. If payload chunk is smaller than `full_scan_threshold_kb` additional indexing won't be used - in this case full-scan search should be preferred by query planner and additional indexing is not required. Note: 1Kb = 1 vector of size 256 + @[JSON::Field(key: "full_scan_threshold", emit_null: false)] + property full_scan_threshold : Int32 + + # Optional properties + # Number of parallel threads used for background index building. If 0 - automatically select from 8 to 16. Best to keep between 8 and 16 to prevent likelihood of slow building or broken/inefficient HNSW graphs. On small CPUs, less threads are used. + @[JSON::Field(key: "max_indexing_threads", emit_null: false)] + property max_indexing_threads : Int32? = 0 + + # Store HNSW index on disk. If set to false, index will be stored in RAM. Default: false + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + # Custom M param for hnsw graph built for payload index. If not set, default M will be used. + @[JSON::Field(key: "payload_m", emit_null: false)] + property payload_m : Int32? + + validates(m, Int32, false, minimum: 0) + validates(ef_construct, Int32, false, minimum: 4) + validates(full_scan_threshold, Int32, false, minimum: 0) + validates(max_indexing_threads, Int32, true, minimum: 0) + validates(payload_m, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@m : Int32, @ef_construct : Int32, @full_scan_threshold : Int32, @max_indexing_threads : Int32? = 0, @on_disk : Bool? = nil, @payload_m : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = m_validation_error(@m)) + invalid_properties.push(msg) + end + if (msg = ef_construct_validation_error(@ef_construct)) + invalid_properties.push(msg) + end + if (msg = full_scan_threshold_validation_error(@full_scan_threshold)) + invalid_properties.push(msg) + end + if (msg = max_indexing_threads_validation_error(@max_indexing_threads)) + invalid_properties.push(msg) + end + if (msg = payload_m_validation_error(@payload_m)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(m, ef_construct, full_scan_threshold, max_indexing_threads, on_disk, payload_m) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/hnsw_config_diff.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/hnsw_config_diff.cr new file mode 100644 index 000000000000..efce2cadb320 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/hnsw_config_diff.cr @@ -0,0 +1,83 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class HnswConfigDiff + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Number of edges per node in the index graph. Larger the value - more accurate the search, more space required. + @[JSON::Field(key: "m", emit_null: false)] + property m : Int32? + + # Number of neighbours to consider during the index building. Larger the value - more accurate the search, more time required to build the index. + @[JSON::Field(key: "ef_construct", emit_null: false)] + property ef_construct : Int32? + + # Minimal size (in kilobytes) of vectors for additional payload-based indexing. If payload chunk is smaller than `full_scan_threshold_kb` additional indexing won't be used - in this case full-scan search should be preferred by query planner and additional indexing is not required. Note: 1Kb = 1 vector of size 256 + @[JSON::Field(key: "full_scan_threshold", emit_null: false)] + property full_scan_threshold : Int32? + + # Number of parallel threads used for background index building. If 0 - automatically select from 8 to 16. Best to keep between 8 and 16 to prevent likelihood of building broken/inefficient HNSW graphs. On small CPUs, less threads are used. + @[JSON::Field(key: "max_indexing_threads", emit_null: false)] + property max_indexing_threads : Int32? + + # Store HNSW index on disk. If set to false, the index will be stored in RAM. Default: false + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + # Custom M param for additional payload-aware HNSW links. If not set, default M will be used. + @[JSON::Field(key: "payload_m", emit_null: false)] + property payload_m : Int32? + + validates(m, Int32, true, minimum: 0) + validates(ef_construct, Int32, true, minimum: 4) + validates(full_scan_threshold, Int32, true, minimum: 10) + validates(max_indexing_threads, Int32, true, minimum: 0) + validates(payload_m, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@m : Int32? = nil, @ef_construct : Int32? = nil, @full_scan_threshold : Int32? = nil, @max_indexing_threads : Int32? = nil, @on_disk : Bool? = nil, @payload_m : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = m_validation_error(@m)) + invalid_properties.push(msg) + end + if (msg = ef_construct_validation_error(@ef_construct)) + invalid_properties.push(msg) + end + if (msg = full_scan_threshold_validation_error(@full_scan_threshold)) + invalid_properties.push(msg) + end + if (msg = max_indexing_threads_validation_error(@max_indexing_threads)) + invalid_properties.push(msg) + end + if (msg = payload_m_validation_error(@payload_m)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(m, ef_construct, full_scan_threshold, max_indexing_threads, on_disk, payload_m) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes.cr new file mode 100644 index 000000000000..e0e2ccdfaec8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Vector index configuration + # Indexes (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. + class Indexes + getter value + + def initialize(@value : IndexesOneOf) + end + def initialize(@value : IndexesOneOf1) + end + + # List of classes defined in oneOf (OpenAPI v3) + def self.openapi_one_of + [ + IndexesOneOf, IndexesOneOf1 + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(IndexesOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(IndexesOneOf1.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in Indexes (oneOf)", 0, 0) + end + + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(IndexesOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(IndexesOneOf1.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in Indexes (oneOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes_one_of.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes_one_of.cr new file mode 100644 index 000000000000..ae05765bd7c6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes_one_of.cr @@ -0,0 +1,50 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Do not use any index, scan whole vector collection during search. Guarantee 100% precision, but may be time consuming on large collections. + class IndexesOneOf + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : String + + @[JSON::Field(key: "options", emit_null: false)] + property options : JSON::Any + + validates(_type, String, false, enum: ["plain"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : String, @options : JSON::Any) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = _type_validation_error(@_type)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, options) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes_one_of1.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes_one_of1.cr new file mode 100644 index 000000000000..9f591988f028 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/indexes_one_of1.cr @@ -0,0 +1,50 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Use filterable HNSW index for approximate search. Is very fast even on a very huge collections, but require additional space to store index and additional time to build it. + class IndexesOneOf1 + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : String + + @[JSON::Field(key: "options", emit_null: false)] + property options : HnswConfig + + validates(_type, String, false, enum: ["hnsw"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : String, @options : HnswConfig) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = _type_validation_error(@_type)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, options) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/init_from.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/init_from.cr new file mode 100644 index 000000000000..b347cfd61dae --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/init_from.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Operation for creating new collection and (optionally) specify index params + class InitFrom + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "collection", emit_null: false)] + property collection : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@collection : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(collection) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/integer_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/integer_index_params.cr new file mode 100644 index 000000000000..8992881d79d1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/integer_index_params.cr @@ -0,0 +1,59 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class IntegerIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : IntegerIndexType + + # Optional properties + # If true - support direct lookups. + @[JSON::Field(key: "lookup", emit_null: false)] + property lookup : Bool? + + # If true - support ranges filters. + @[JSON::Field(key: "range", emit_null: false)] + property range : Bool? + + # If true - use this key to organize storage of the collection data. This option assumes that this key will be used in majority of filtered requests. + @[JSON::Field(key: "is_principal", emit_null: false)] + property is_principal : Bool? + + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : IntegerIndexType, @lookup : Bool? = nil, @range : Bool? = nil, @is_principal : Bool? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, lookup, range, is_principal, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/integer_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/integer_index_type.cr new file mode 100644 index 000000000000..e78d34d96c72 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/integer_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # IntegerIndexType (OpenAPI enum). Allowed values: "integer". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias IntegerIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/is_empty_condition.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/is_empty_condition.cr new file mode 100644 index 000000000000..f8e91f4777f9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/is_empty_condition.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Select points with empty payload for a specified field + class IsEmptyCondition + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "is_empty", emit_null: false)] + property is_empty : PayloadField + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@is_empty : PayloadField) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(is_empty) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/is_null_condition.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/is_null_condition.cr new file mode 100644 index 000000000000..21b2dbabd195 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/is_null_condition.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Select points with null payload for a specified field + class IsNullCondition + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "is_null", emit_null: false)] + property is_null : PayloadField + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@is_null : PayloadField) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(is_null) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/keyword_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/keyword_index_params.cr new file mode 100644 index 000000000000..2efe90e9a3c8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/keyword_index_params.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class KeywordIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : KeywordIndexType + + # Optional properties + # If true - used for tenant optimization. Default: false. + @[JSON::Field(key: "is_tenant", emit_null: false)] + property is_tenant : Bool? + + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : KeywordIndexType, @is_tenant : Bool? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, is_tenant, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/keyword_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/keyword_index_type.cr new file mode 100644 index 000000000000..6b2ac91ddad9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/keyword_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # KeywordIndexType (OpenAPI enum). Allowed values: "keyword". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias KeywordIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/list_snapshots200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/list_snapshots200_response.cr new file mode 100644 index 000000000000..bdbe5a4c2035 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/list_snapshots200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ListSnapshots200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Array(SnapshotDescription)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Array(SnapshotDescription)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/local_shard_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/local_shard_info.cr new file mode 100644 index 000000000000..3c2c8606a21b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/local_shard_info.cr @@ -0,0 +1,63 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class LocalShardInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Local shard id + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + # Number of points in the shard + @[JSON::Field(key: "points_count", emit_null: false)] + property points_count : Int32 + + @[JSON::Field(key: "state", emit_null: false)] + property state : ReplicaState + + # Optional properties + # User-defined sharding key + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey? + + validates(shard_id, Int32, false, minimum: 0) + validates(points_count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @points_count : Int32, @state : ReplicaState, @shard_key : ShardKey? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = points_count_validation_error(@points_count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, shard_key, points_count, state) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/local_shard_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/local_shard_telemetry.cr new file mode 100644 index 000000000000..613a9f4d906c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/local_shard_telemetry.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class LocalShardTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Total number of optimized points since the last start. + @[JSON::Field(key: "total_optimized_points", emit_null: false)] + property total_optimized_points : Int32 + + @[JSON::Field(key: "segments", emit_null: false)] + property segments : Array(SegmentTelemetry) + + @[JSON::Field(key: "optimizations", emit_null: false)] + property optimizations : OptimizerTelemetry + + # Optional properties + @[JSON::Field(key: "variant_name", emit_null: false)] + property variant_name : String? + + @[JSON::Field(key: "status", emit_null: false)] + property status : ShardStatus? + + validates(total_optimized_points, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@total_optimized_points : Int32, @segments : Array(SegmentTelemetry), @optimizations : OptimizerTelemetry, @variant_name : String? = nil, @status : ShardStatus? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = total_optimized_points_validation_error(@total_optimized_points)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(variant_name, status, total_optimized_points, segments, optimizations) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/locks_option.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/locks_option.cr new file mode 100644 index 000000000000..bc2f879f03b2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/locks_option.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class LocksOption + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "write", emit_null: false)] + property write : Bool + + # Optional properties + @[JSON::Field(key: "error_message", emit_null: false)] + property error_message : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@write : Bool, @error_message : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(error_message, write) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/lookup_location.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/lookup_location.cr new file mode 100644 index 000000000000..df6430aece9a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/lookup_location.cr @@ -0,0 +1,53 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Defines a location to use for looking up the vector. Specifies collection and vector field name. + class LookupLocation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Name of the collection used for lookup + @[JSON::Field(key: "collection", emit_null: false)] + property collection : String + + # Optional properties + # Optional name of the vector field within the collection. If not provided, the default vector field will be used. + @[JSON::Field(key: "vector", emit_null: false)] + property vector : String? + + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@collection : String, @vector : String? = nil, @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(collection, vector, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/match.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match.cr new file mode 100644 index 000000000000..da603ec15f2d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match.cr @@ -0,0 +1,91 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Match filter request + # Match (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class Match + getter value + + def initialize(@value : MatchAny) + end + def initialize(@value : MatchExcept) + end + def initialize(@value : MatchText) + end + def initialize(@value : MatchValue) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + MatchAny, MatchExcept, MatchText, MatchValue + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(MatchAny.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(MatchExcept.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(MatchText.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(MatchValue.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in Match (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(MatchAny.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(MatchExcept.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(MatchText.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(MatchValue.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in Match (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_any.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_any.cr new file mode 100644 index 000000000000..c705fe1338c9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_any.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Exact match on any of the given values + class MatchAny + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "any", emit_null: false)] + property any : AnyVariants + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@any : AnyVariants) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(any) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_except.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_except.cr new file mode 100644 index 000000000000..43fd1baeb1f7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_except.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Should have at least one value not matching the any given values + class MatchExcept + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "except", emit_null: false)] + property except : AnyVariants + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@except : AnyVariants) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(except) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_text.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_text.cr new file mode 100644 index 000000000000..3892200a3c2f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_text.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Full-text match of the strings. + class MatchText + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "text", emit_null: false)] + property text : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@text : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(text) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_value.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_value.cr new file mode 100644 index 000000000000..f2d74a8f12a3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/match_value.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Exact match of the given value + class MatchValue + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "value", emit_null: false)] + property value : ValueVariants + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@value : ValueVariants) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(value) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/message_send_errors.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/message_send_errors.cr new file mode 100644 index 000000000000..7fd0473c67ae --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/message_send_errors.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Message send failures for a particular peer + class MessageSendErrors + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "count", emit_null: false)] + property count : Int32 + + # Optional properties + @[JSON::Field(key: "latest_error", emit_null: false)] + property latest_error : String? + + # Timestamp of the latest error + @[JSON::Field(key: "latest_error_timestamp", emit_null: false)] + property latest_error_timestamp : Time? + + validates(count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@count : Int32, @latest_error : String? = nil, @latest_error_timestamp : Time? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = count_validation_error(@count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(count, latest_error, latest_error_timestamp) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/min_should.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/min_should.cr new file mode 100644 index 000000000000..647c442c8a02 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/min_should.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class MinShould + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "conditions", emit_null: false)] + property conditions : Array(Condition) + + @[JSON::Field(key: "min_count", emit_null: false)] + property min_count : Int32 + + validates(min_count, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@conditions : Array(Condition), @min_count : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = min_count_validation_error(@min_count)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(conditions, min_count) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/modifier.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/modifier.cr new file mode 100644 index 000000000000..137f3c219967 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/modifier.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Modifier (OpenAPI enum). Allowed values: "none", "idf". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Modifier = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/move_shard.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/move_shard.cr new file mode 100644 index 000000000000..da4f543ec2e0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/move_shard.cr @@ -0,0 +1,65 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class MoveShard + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "to_peer_id", emit_null: false)] + property to_peer_id : Int32 + + @[JSON::Field(key: "from_peer_id", emit_null: false)] + property from_peer_id : Int32 + + # Optional properties + # Method for transferring the shard from one node to another + @[JSON::Field(key: "method", emit_null: false)] + property method : ShardTransferMethod? + + validates(shard_id, Int32, false, minimum: 0) + validates(to_peer_id, Int32, false, minimum: 0) + validates(from_peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @to_peer_id : Int32, @from_peer_id : Int32, @method : ShardTransferMethod? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = to_peer_id_validation_error(@to_peer_id)) + invalid_properties.push(msg) + end + if (msg = from_peer_id_validation_error(@from_peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, to_peer_id, from_peer_id, method) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/move_shard_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/move_shard_operation.cr new file mode 100644 index 000000000000..963c7d978084 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/move_shard_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class MoveShardOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "move_shard", emit_null: false)] + property move_shard : MoveShard + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@move_shard : MoveShard) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(move_shard) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/multi_vector_comparator.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/multi_vector_comparator.cr new file mode 100644 index 000000000000..8392f3ca1d63 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/multi_vector_comparator.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # MultiVectorComparator (OpenAPI enum). Allowed values: "max_sim". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias MultiVectorComparator = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/multi_vector_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/multi_vector_config.cr new file mode 100644 index 000000000000..3c117ac4c9fc --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/multi_vector_config.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class MultiVectorConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "comparator", emit_null: false)] + property comparator : MultiVectorComparator + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@comparator : MultiVectorComparator) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(comparator) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_sparse_vector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_sparse_vector.cr new file mode 100644 index 000000000000..af4c6776670f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_sparse_vector.cr @@ -0,0 +1,47 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Sparse vector data with name + class NamedSparseVector + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Name of vector data + @[JSON::Field(key: "name", emit_null: false)] + property name : String + + @[JSON::Field(key: "vector", emit_null: false)] + property vector : SparseVector + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String, @vector : SparseVector) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, vector) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_vector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_vector.cr new file mode 100644 index 000000000000..48dda76994ec --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_vector.cr @@ -0,0 +1,48 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Dense vector data with name + class NamedVector + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Name of vector data + @[JSON::Field(key: "name", emit_null: false)] + property name : String + + # Vector data + @[JSON::Field(key: "vector", emit_null: false)] + property vector : Array(Float32) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String, @vector : Array(Float32)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, vector) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_vector_struct.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_vector_struct.cr new file mode 100644 index 000000000000..6bafc9e7064e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/named_vector_struct.cr @@ -0,0 +1,81 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Vector data separator for named and unnamed modes Unnamed mode: { \"vector\": [1.0, 2.0, 3.0] } or named mode: { \"vector\": { \"vector\": [1.0, 2.0, 3.0], \"name\": \"image-embeddings\" } } + # NamedVectorStruct (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class NamedVectorStruct + getter value + + def initialize(@value : Array(Float32)) + end + def initialize(@value : NamedSparseVector) + end + def initialize(@value : NamedVector) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Float32), NamedSparseVector, NamedVector + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Float32).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(NamedSparseVector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(NamedVector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in NamedVectorStruct (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Float32).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(NamedSparseVector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(NamedVector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in NamedVectorStruct (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/nearest_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/nearest_query.cr new file mode 100644 index 000000000000..ec1614b28b18 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/nearest_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class NearestQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "nearest", emit_null: false)] + property nearest : VectorInput + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@nearest : VectorInput) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(nearest) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/nested.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/nested.cr new file mode 100644 index 000000000000..853980c01a37 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/nested.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Select points with payload for a specified nested field + class Nested + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "key", emit_null: false)] + property key : String + + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@key : String, @filter : Filter) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(key, filter) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/nested_condition.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/nested_condition.cr new file mode 100644 index 000000000000..0e38cf71188a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/nested_condition.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class NestedCondition + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "nested", emit_null: false)] + property nested : Nested + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@nested : Nested) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(nested) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/operation_duration_statistics.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/operation_duration_statistics.cr new file mode 100644 index 000000000000..1c52d4d7b110 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/operation_duration_statistics.cr @@ -0,0 +1,77 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OperationDurationStatistics + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "count", emit_null: false)] + property count : Int32 + + # The total duration of all operations in microseconds. + @[JSON::Field(key: "total_duration_micros", emit_null: false)] + property total_duration_micros : Int32 + + # Optional properties + @[JSON::Field(key: "fail_count", emit_null: false)] + property fail_count : Int32? + + # The average time taken by 128 latest operations, calculated as a weighted mean. + @[JSON::Field(key: "avg_duration_micros", emit_null: false)] + property avg_duration_micros : Float32? + + # The minimum duration of the operations across all the measurements. + @[JSON::Field(key: "min_duration_micros", emit_null: false)] + property min_duration_micros : Float32? + + # The maximum duration of the operations across all the measurements. + @[JSON::Field(key: "max_duration_micros", emit_null: false)] + property max_duration_micros : Float32? + + @[JSON::Field(key: "last_responded", emit_null: false)] + property last_responded : Time? + + validates(count, Int32, false, minimum: 0) + validates(fail_count, Int32, true, minimum: 0) + validates(total_duration_micros, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@count : Int32, @total_duration_micros : Int32, @fail_count : Int32? = nil, @avg_duration_micros : Float32? = nil, @min_duration_micros : Float32? = nil, @max_duration_micros : Float32? = nil, @last_responded : Time? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = count_validation_error(@count)) + invalid_properties.push(msg) + end + if (msg = fail_count_validation_error(@fail_count)) + invalid_properties.push(msg) + end + if (msg = total_duration_micros_validation_error(@total_duration_micros)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(count, fail_count, avg_duration_micros, min_duration_micros, max_duration_micros, total_duration_micros, last_responded) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizer_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizer_telemetry.cr new file mode 100644 index 000000000000..70b024f6c2d2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizer_telemetry.cr @@ -0,0 +1,48 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OptimizerTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "status", emit_null: false)] + property status : OptimizersStatus + + @[JSON::Field(key: "optimizations", emit_null: false)] + property optimizations : OperationDurationStatistics + + @[JSON::Field(key: "log", emit_null: false)] + property log : Array(TrackerTelemetry) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@status : OptimizersStatus, @optimizations : OperationDurationStatistics, @log : Array(TrackerTelemetry)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(status, optimizations, log) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_config.cr new file mode 100644 index 000000000000..4de2f6b14e7e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_config.cr @@ -0,0 +1,104 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OptimizersConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # The minimal fraction of deleted vectors in a segment, required to perform segment optimization + @[JSON::Field(key: "deleted_threshold", emit_null: false)] + property deleted_threshold : Float64 + + # The minimal number of vectors in a segment, required to perform segment optimization + @[JSON::Field(key: "vacuum_min_vector_number", emit_null: false)] + property vacuum_min_vector_number : Int32 + + # Target amount of segments optimizer will try to keep. Real amount of segments may vary depending on multiple parameters: - Amount of stored points - Current write RPS It is recommended to select default number of segments as a factor of the number of search threads, so that each segment would be handled evenly by one of the threads. If `default_segment_number = 0`, will be automatically selected by the number of available CPUs. + @[JSON::Field(key: "default_segment_number", emit_null: false)] + property default_segment_number : Int32 + + # Minimum interval between forced flushes. + @[JSON::Field(key: "flush_interval_sec", emit_null: false)] + property flush_interval_sec : Int32 + + # Optional properties + # Do not create segments larger this size (in kilobytes). Large segments might require disproportionately long indexation times, therefore it makes sense to limit the size of segments. If indexing speed is more important - make this parameter lower. If search speed is more important - make this parameter higher. Note: 1Kb = 1 vector of size 256 If not set, will be automatically selected considering the number of available CPUs. + @[JSON::Field(key: "max_segment_size", emit_null: false)] + property max_segment_size : Int32? + + # Maximum size (in kilobytes) of vectors to store in-memory per segment. Segments larger than this threshold will be stored as read-only memmaped file. Memmap storage is disabled by default, to enable it, set this threshold to a reasonable value. To disable memmap storage, set this to `0`. Internally it will use the largest threshold possible. Note: 1Kb = 1 vector of size 256 + @[JSON::Field(key: "memmap_threshold", emit_null: false)] + property memmap_threshold : Int32? + + # Maximum size (in kilobytes) of vectors allowed for plain index, exceeding this threshold will enable vector indexing Default value is 20,000, based on . To disable vector indexing, set to `0`. Note: 1kB = 1 vector of size 256. + @[JSON::Field(key: "indexing_threshold", emit_null: false)] + property indexing_threshold : Int32? + + # Max number of threads (jobs) for running optimizations per shard. Note: each optimization job will also use `max_indexing_threads` threads by itself for index building. If null - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled. + @[JSON::Field(key: "max_optimization_threads", emit_null: false)] + property max_optimization_threads : Int32? + + validates(deleted_threshold, Float64, false, maximum: 1, minimum: 0) + validates(vacuum_min_vector_number, Int32, false, minimum: 100) + validates(default_segment_number, Int32, false, minimum: 0) + validates(max_segment_size, Int32, true, minimum: 0) + validates(memmap_threshold, Int32, true, minimum: 0) + validates(indexing_threshold, Int32, true, minimum: 0) + validates(flush_interval_sec, Int32, false, minimum: 0) + validates(max_optimization_threads, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@deleted_threshold : Float64, @vacuum_min_vector_number : Int32, @default_segment_number : Int32, @flush_interval_sec : Int32, @max_segment_size : Int32? = nil, @memmap_threshold : Int32? = nil, @indexing_threshold : Int32? = nil, @max_optimization_threads : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = deleted_threshold_validation_error(@deleted_threshold)) + invalid_properties.push(msg) + end + if (msg = vacuum_min_vector_number_validation_error(@vacuum_min_vector_number)) + invalid_properties.push(msg) + end + if (msg = default_segment_number_validation_error(@default_segment_number)) + invalid_properties.push(msg) + end + if (msg = max_segment_size_validation_error(@max_segment_size)) + invalid_properties.push(msg) + end + if (msg = memmap_threshold_validation_error(@memmap_threshold)) + invalid_properties.push(msg) + end + if (msg = indexing_threshold_validation_error(@indexing_threshold)) + invalid_properties.push(msg) + end + if (msg = flush_interval_sec_validation_error(@flush_interval_sec)) + invalid_properties.push(msg) + end + if (msg = max_optimization_threads_validation_error(@max_optimization_threads)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(deleted_threshold, vacuum_min_vector_number, default_segment_number, max_segment_size, memmap_threshold, indexing_threshold, flush_interval_sec, max_optimization_threads) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_config_diff.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_config_diff.cr new file mode 100644 index 000000000000..76a2f8ba971f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_config_diff.cr @@ -0,0 +1,99 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OptimizersConfigDiff + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # The minimal fraction of deleted vectors in a segment, required to perform segment optimization + @[JSON::Field(key: "deleted_threshold", emit_null: false)] + property deleted_threshold : Float64? + + # The minimal number of vectors in a segment, required to perform segment optimization + @[JSON::Field(key: "vacuum_min_vector_number", emit_null: false)] + property vacuum_min_vector_number : Int32? + + # Target amount of segments optimizer will try to keep. Real amount of segments may vary depending on multiple parameters: - Amount of stored points - Current write RPS It is recommended to select default number of segments as a factor of the number of search threads, so that each segment would be handled evenly by one of the threads If `default_segment_number = 0`, will be automatically selected by the number of available CPUs + @[JSON::Field(key: "default_segment_number", emit_null: false)] + property default_segment_number : Int32? + + # Do not create segments larger this size (in kilobytes). Large segments might require disproportionately long indexation times, therefore it makes sense to limit the size of segments. If indexation speed have more priority for your - make this parameter lower. If search speed is more important - make this parameter higher. Note: 1Kb = 1 vector of size 256 + @[JSON::Field(key: "max_segment_size", emit_null: false)] + property max_segment_size : Int32? + + # Maximum size (in kilobytes) of vectors to store in-memory per segment. Segments larger than this threshold will be stored as read-only memmaped file. Memmap storage is disabled by default, to enable it, set this threshold to a reasonable value. To disable memmap storage, set this to `0`. Note: 1Kb = 1 vector of size 256 + @[JSON::Field(key: "memmap_threshold", emit_null: false)] + property memmap_threshold : Int32? + + # Maximum size (in kilobytes) of vectors allowed for plain index, exceeding this threshold will enable vector indexing Default value is 20,000, based on . To disable vector indexing, set to `0`. Note: 1kB = 1 vector of size 256. + @[JSON::Field(key: "indexing_threshold", emit_null: false)] + property indexing_threshold : Int32? + + # Minimum interval between forced flushes. + @[JSON::Field(key: "flush_interval_sec", emit_null: false)] + property flush_interval_sec : Int32? + + # Max number of threads (jobs) for running optimizations per shard. Note: each optimization job will also use `max_indexing_threads` threads by itself for index building. If null - have no limit and choose dynamically to saturate CPU. If 0 - no optimization threads, optimizations will be disabled. + @[JSON::Field(key: "max_optimization_threads", emit_null: false)] + property max_optimization_threads : Int32? + + validates(vacuum_min_vector_number, Int32, true, minimum: 0) + validates(default_segment_number, Int32, true, minimum: 0) + validates(max_segment_size, Int32, true, minimum: 0) + validates(memmap_threshold, Int32, true, minimum: 0) + validates(indexing_threshold, Int32, true, minimum: 0) + validates(flush_interval_sec, Int32, true, minimum: 0) + validates(max_optimization_threads, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@deleted_threshold : Float64? = nil, @vacuum_min_vector_number : Int32? = nil, @default_segment_number : Int32? = nil, @max_segment_size : Int32? = nil, @memmap_threshold : Int32? = nil, @indexing_threshold : Int32? = nil, @flush_interval_sec : Int32? = nil, @max_optimization_threads : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = vacuum_min_vector_number_validation_error(@vacuum_min_vector_number)) + invalid_properties.push(msg) + end + if (msg = default_segment_number_validation_error(@default_segment_number)) + invalid_properties.push(msg) + end + if (msg = max_segment_size_validation_error(@max_segment_size)) + invalid_properties.push(msg) + end + if (msg = memmap_threshold_validation_error(@memmap_threshold)) + invalid_properties.push(msg) + end + if (msg = indexing_threshold_validation_error(@indexing_threshold)) + invalid_properties.push(msg) + end + if (msg = flush_interval_sec_validation_error(@flush_interval_sec)) + invalid_properties.push(msg) + end + if (msg = max_optimization_threads_validation_error(@max_optimization_threads)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(deleted_threshold, vacuum_min_vector_number, default_segment_number, max_segment_size, memmap_threshold, indexing_threshold, flush_interval_sec, max_optimization_threads) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_status.cr new file mode 100644 index 000000000000..aa75c566793c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_status.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Current state of the collection + # OptimizersStatus (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. + class OptimizersStatus + getter value + + def initialize(@value : OptimizersStatusOneOf) + end + def initialize(@value : String) + end + + # List of classes defined in oneOf (OpenAPI v3) + def self.openapi_one_of + [ + OptimizersStatusOneOf, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(OptimizersStatusOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in OptimizersStatus (oneOf)", 0, 0) + end + + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(OptimizersStatusOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in OptimizersStatus (oneOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_status_one_of.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_status_one_of.cr new file mode 100644 index 000000000000..9a94ebb7db2c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/optimizers_status_one_of.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Something wrong happened with optimizers + class OptimizersStatusOneOf + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "error", emit_null: false)] + property error : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@error : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(error) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by.cr new file mode 100644 index 000000000000..46031c8dc31d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OrderBy + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Payload key to order by + @[JSON::Field(key: "key", emit_null: false)] + property key : String + + # Optional properties + # Direction of ordering: `asc` or `desc`. Default is ascending. + @[JSON::Field(key: "direction", emit_null: false)] + property direction : Direction? + + # Which payload value to start scrolling from. Default is the lowest value for `asc` and the highest for `desc` + @[JSON::Field(key: "start_from", emit_null: false)] + property start_from : StartFrom? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@key : String, @direction : Direction? = nil, @start_from : StartFrom? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(key, direction, start_from) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by_interface.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by_interface.cr new file mode 100644 index 000000000000..e830dd54ad33 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by_interface.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # OrderByInterface (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class OrderByInterface + getter value + + def initialize(@value : OrderBy) + end + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + OrderBy, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(OrderBy.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in OrderByInterface (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(OrderBy.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in OrderByInterface (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by_query.cr new file mode 100644 index 000000000000..4bab6664caa8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_by_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OrderByQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "order_by", emit_null: false)] + property order_by : OrderByInterface + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@order_by : OrderByInterface) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(order_by) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_value.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_value.cr new file mode 100644 index 000000000000..d1cddaedcdf9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/order_value.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # OrderValue (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class OrderValue + getter value + + def initialize(@value : Float64) + end + def initialize(@value : Int64) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Float64, Int64 + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Float64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in OrderValue (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Float64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in OrderValue (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/overwrite_payload_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/overwrite_payload_operation.cr new file mode 100644 index 000000000000..77f17f06d36a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/overwrite_payload_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class OverwritePayloadOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "overwrite_payload", emit_null: false)] + property overwrite_payload : SetPayload + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@overwrite_payload : SetPayload) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(overwrite_payload) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/p2p_config_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/p2p_config_telemetry.cr new file mode 100644 index 000000000000..2b132d1ad1fc --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/p2p_config_telemetry.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class P2pConfigTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "connection_pool_size", emit_null: false)] + property connection_pool_size : Int32 + + validates(connection_pool_size, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@connection_pool_size : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = connection_pool_size_validation_error(@connection_pool_size)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(connection_pool_size) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_field.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_field.cr new file mode 100644 index 000000000000..47bfc2b38cec --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_field.cr @@ -0,0 +1,44 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Payload field + class PayloadField + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Payload field name + @[JSON::Field(key: "key", emit_null: false)] + property key : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@key : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_field_schema.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_field_schema.cr new file mode 100644 index 000000000000..44a5890e46e8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_field_schema.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # PayloadFieldSchema (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class PayloadFieldSchema + getter value + + def initialize(@value : PayloadSchemaParams) + end + def initialize(@value : PayloadSchemaType) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + PayloadSchemaParams, PayloadSchemaType + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(PayloadSchemaParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadSchemaType.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in PayloadFieldSchema (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(PayloadSchemaParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadSchemaType.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in PayloadFieldSchema (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_index_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_index_info.cr new file mode 100644 index 000000000000..3b404ae21b5d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_index_info.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Display payload field type & index information + class PayloadIndexInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "data_type", emit_null: false)] + property data_type : PayloadSchemaType + + # Number of points indexed with this index + @[JSON::Field(key: "points", emit_null: false)] + property points : Int32 + + # Optional properties + @[JSON::Field(key: "params", emit_null: false)] + property params : PayloadSchemaParams? + + validates(points, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@data_type : PayloadSchemaType, @points : Int32, @params : PayloadSchemaParams? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = points_validation_error(@points)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(data_type, params, points) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_index_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_index_telemetry.cr new file mode 100644 index 000000000000..cc832c63d22f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_index_telemetry.cr @@ -0,0 +1,64 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PayloadIndexTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "points_values_count", emit_null: false)] + property points_values_count : Int32 + + @[JSON::Field(key: "points_count", emit_null: false)] + property points_count : Int32 + + # Optional properties + @[JSON::Field(key: "field_name", emit_null: false)] + property field_name : String? + + @[JSON::Field(key: "histogram_bucket_size", emit_null: false)] + property histogram_bucket_size : Int32? + + validates(points_values_count, Int32, false, minimum: 0) + validates(points_count, Int32, false, minimum: 0) + validates(histogram_bucket_size, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points_values_count : Int32, @points_count : Int32, @field_name : String? = nil, @histogram_bucket_size : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = points_values_count_validation_error(@points_values_count)) + invalid_properties.push(msg) + end + if (msg = points_count_validation_error(@points_count)) + invalid_properties.push(msg) + end + if (msg = histogram_bucket_size_validation_error(@histogram_bucket_size)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(field_name, points_values_count, points_count, histogram_bucket_size) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_schema_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_schema_params.cr new file mode 100644 index 000000000000..2f17ac2abe23 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_schema_params.cr @@ -0,0 +1,131 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Payload type with parameters + # PayloadSchemaParams (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class PayloadSchemaParams + getter value + + def initialize(@value : BoolIndexParams) + end + def initialize(@value : DatetimeIndexParams) + end + def initialize(@value : FloatIndexParams) + end + def initialize(@value : GeoIndexParams) + end + def initialize(@value : IntegerIndexParams) + end + def initialize(@value : KeywordIndexParams) + end + def initialize(@value : TextIndexParams) + end + def initialize(@value : UuidIndexParams) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + BoolIndexParams, DatetimeIndexParams, FloatIndexParams, GeoIndexParams, IntegerIndexParams, KeywordIndexParams, TextIndexParams, UuidIndexParams + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(BoolIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DatetimeIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(FloatIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(GeoIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(IntegerIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(KeywordIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(TextIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(UuidIndexParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in PayloadSchemaParams (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(BoolIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DatetimeIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(FloatIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(GeoIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(IntegerIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(KeywordIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(TextIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(UuidIndexParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in PayloadSchemaParams (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_schema_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_schema_type.cr new file mode 100644 index 000000000000..08c02c6c74b4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_schema_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # PayloadSchemaType (OpenAPI enum). Allowed values: "keyword", "integer", "float", "geo", "text", "bool", "datetime", "uuid". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias PayloadSchemaType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector.cr new file mode 100644 index 000000000000..b14a820397c2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Specifies how to treat payload selector + # PayloadSelector (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class PayloadSelector + getter value + + def initialize(@value : PayloadSelectorExclude) + end + def initialize(@value : PayloadSelectorInclude) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + PayloadSelectorExclude, PayloadSelectorInclude + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(PayloadSelectorExclude.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadSelectorInclude.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in PayloadSelector (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(PayloadSelectorExclude.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadSelectorInclude.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in PayloadSelector (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector_exclude.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector_exclude.cr new file mode 100644 index 000000000000..06fcdee8b614 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector_exclude.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PayloadSelectorExclude + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Exclude this fields from returning payload + @[JSON::Field(key: "exclude", emit_null: false)] + property exclude : Array(String) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@exclude : Array(String)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(exclude) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector_include.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector_include.cr new file mode 100644 index 000000000000..432f081e5a1b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_selector_include.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PayloadSelectorInclude + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Only include this payload keys + @[JSON::Field(key: "include", emit_null: false)] + property _include : Array(String) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_include : Array(String)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_include) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type.cr new file mode 100644 index 000000000000..789a13a707a5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Type of payload storage + # PayloadStorageType (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. + class PayloadStorageType + getter value + + def initialize(@value : PayloadStorageTypeOneOf) + end + def initialize(@value : PayloadStorageTypeOneOf1) + end + + # List of classes defined in oneOf (OpenAPI v3) + def self.openapi_one_of + [ + PayloadStorageTypeOneOf, PayloadStorageTypeOneOf1 + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(PayloadStorageTypeOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadStorageTypeOneOf1.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in PayloadStorageType (oneOf)", 0, 0) + end + + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(PayloadStorageTypeOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadStorageTypeOneOf1.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in PayloadStorageType (oneOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type_one_of.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type_one_of.cr new file mode 100644 index 000000000000..932220e88631 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type_one_of.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PayloadStorageTypeOneOf + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : String + + validates(_type, String, false, enum: ["in_memory"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = _type_validation_error(@_type)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type_one_of1.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type_one_of1.cr new file mode 100644 index 000000000000..e8de199fc989 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/payload_storage_type_one_of1.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PayloadStorageTypeOneOf1 + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : String + + validates(_type, String, false, enum: ["on_disk"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = _type_validation_error(@_type)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/peer_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/peer_info.cr new file mode 100644 index 000000000000..57a0f1d5366e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/peer_info.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Information of a peer in the cluster + class PeerInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "uri", emit_null: false)] + property uri : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@uri : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(uri) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_group.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_group.cr new file mode 100644 index 000000000000..bb30a6d96487 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_group.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointGroup + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Scored points that have the same value of the group_by key + @[JSON::Field(key: "hits", emit_null: false)] + property hits : Array(ScoredPoint) + + @[JSON::Field(key: "id", emit_null: false)] + property id : GroupId + + # Optional properties + # Record that has been looked up using the group id + @[JSON::Field(key: "lookup", emit_null: false)] + property lookup : Record? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@hits : Array(ScoredPoint), @id : GroupId, @lookup : Record? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(hits, id, lookup) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_ids_list.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_ids_list.cr new file mode 100644 index 000000000000..bd0223416c1c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_ids_list.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointIdsList + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(ExtendedPointId) + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points : Array(ExtendedPointId), @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_insert_operations.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_insert_operations.cr new file mode 100644 index 000000000000..8eaab4af4e00 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_insert_operations.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # PointInsertOperations (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class PointInsertOperations + getter value + + def initialize(@value : PointsBatch) + end + def initialize(@value : PointsList) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + PointsBatch, PointsList + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(PointsBatch.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(PointsList.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in PointInsertOperations (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(PointsBatch.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(PointsList.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in PointInsertOperations (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_request.cr new file mode 100644 index 000000000000..deacdb0a4afa --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_request.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Look for points with ids + @[JSON::Field(key: "ids", emit_null: false)] + property ids : Array(ExtendedPointId) + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Select which payload to return with the response. Default is true. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@ids : Array(ExtendedPointId), @shard_key : ShardKeySelector? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, ids, with_payload, with_vector) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_struct.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_struct.cr new file mode 100644 index 000000000000..d86d11f6bff6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_struct.cr @@ -0,0 +1,50 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointStruct + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : ExtendedPointId + + @[JSON::Field(key: "vector", emit_null: false)] + property vector : VectorStruct + + # Optional properties + # Payload values (optional) + @[JSON::Field(key: "payload", emit_null: false)] + property payload : Hash(String, JSON::Any)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : ExtendedPointId, @vector : VectorStruct, @payload : Hash(String, JSON::Any)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, vector, payload) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_vectors.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_vectors.cr new file mode 100644 index 000000000000..a27dbdab6aa7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/point_vectors.cr @@ -0,0 +1,45 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointVectors + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : ExtendedPointId + + @[JSON::Field(key: "vector", emit_null: false)] + property vector : VectorStruct + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : ExtendedPointId, @vector : VectorStruct) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, vector) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_batch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_batch.cr new file mode 100644 index 000000000000..60705f7d8c4a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_batch.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointsBatch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "batch", emit_null: false)] + property batch : Batch + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@batch : Batch, @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(batch, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_list.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_list.cr new file mode 100644 index 000000000000..44681135622d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_list.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class PointsList + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(PointStruct) + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points : Array(PointStruct), @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_selector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_selector.cr new file mode 100644 index 000000000000..491f30a14d9a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/points_selector.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # PointsSelector (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class PointsSelector + getter value + + def initialize(@value : FilterSelector) + end + def initialize(@value : PointIdsList) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + FilterSelector, PointIdsList + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(FilterSelector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(PointIdsList.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in PointsSelector (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(FilterSelector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(PointIdsList.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in PointsSelector (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/prefetch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/prefetch.cr new file mode 100644 index 000000000000..8168f8c75a13 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/prefetch.cr @@ -0,0 +1,74 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Prefetch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + @[JSON::Field(key: "prefetch", emit_null: false)] + property prefetch : QueryRequestPrefetch? + + # Query to perform. If missing without prefetches, returns points ordered by their IDs. + @[JSON::Field(key: "query", emit_null: false)] + property query : QueryInterface? + + # Define which vector name to use for querying. If missing, the default vector is used. + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + # Filter conditions - return only those points that satisfy the specified conditions. + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Search params for when there is no prefetch + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Return points with scores better than this threshold. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + # Max number of points to return. Default is 10. + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32? + + # The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection + @[JSON::Field(key: "lookup_from", emit_null: false)] + property lookup_from : LookupLocation? + + validates(limit, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@prefetch : QueryRequestPrefetch? = nil, @query : QueryInterface? = nil, @using : String? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @score_threshold : Float32? = nil, @limit : Int32? = nil, @lookup_from : LookupLocation? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(prefetch, query, using, filter, params, score_threshold, limit, lookup_from) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/product_quantization.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/product_quantization.cr new file mode 100644 index 000000000000..fcf1763efba9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/product_quantization.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ProductQuantization + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "product", emit_null: false)] + property product : ProductQuantizationConfig + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@product : ProductQuantizationConfig) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(product) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/product_quantization_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/product_quantization_config.cr new file mode 100644 index 000000000000..63330c0262ad --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/product_quantization_config.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ProductQuantizationConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "compression", emit_null: false)] + property compression : CompressionRatio + + # Optional properties + @[JSON::Field(key: "always_ram", emit_null: false)] + property always_ram : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@compression : CompressionRatio, @always_ram : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(compression, always_ram) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_config.cr new file mode 100644 index 000000000000..38b8c320f59b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_config.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # QuantizationConfig (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class QuantizationConfig + getter value + + def initialize(@value : BinaryQuantization) + end + def initialize(@value : ProductQuantization) + end + def initialize(@value : ScalarQuantization) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + BinaryQuantization, ProductQuantization, ScalarQuantization + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(BinaryQuantization.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ProductQuantization.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ScalarQuantization.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in QuantizationConfig (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(BinaryQuantization.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ProductQuantization.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ScalarQuantization.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in QuantizationConfig (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_config_diff.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_config_diff.cr new file mode 100644 index 000000000000..ea3caabdc79c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_config_diff.cr @@ -0,0 +1,90 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # QuantizationConfigDiff (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class QuantizationConfigDiff + getter value + + def initialize(@value : BinaryQuantization) + end + def initialize(@value : Disabled) + end + def initialize(@value : ProductQuantization) + end + def initialize(@value : ScalarQuantization) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + BinaryQuantization, Disabled, ProductQuantization, ScalarQuantization + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(BinaryQuantization.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Disabled.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ProductQuantization.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ScalarQuantization.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in QuantizationConfigDiff (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(BinaryQuantization.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Disabled.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ProductQuantization.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ScalarQuantization.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in QuantizationConfigDiff (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_search_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_search_params.cr new file mode 100644 index 000000000000..77aaeead47cf --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/quantization_search_params.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Additional parameters of the search + class QuantizationSearchParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # If true, quantized vectors are ignored. Default is false. + @[JSON::Field(key: "ignore", emit_null: false)] + property ignore : Bool? = false + + # If true, use original vectors to re-score top-k results. Might require more time in case if original vectors are stored on disk. If not set, qdrant decides automatically apply rescoring or not. + @[JSON::Field(key: "rescore", emit_null: false)] + property rescore : Bool? + + # Oversampling factor for quantization. Default is 1.0. Defines how many extra vectors should be pre-selected using quantized index, and then re-scored using original vectors. For example, if `oversampling` is 2.4 and `limit` is 100, then 240 vectors will be pre-selected using quantized index, and then top-100 will be returned after re-scoring. + @[JSON::Field(key: "oversampling", emit_null: false)] + property oversampling : Float64? + + validates(oversampling, Float64, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@ignore : Bool? = false, @rescore : Bool? = nil, @oversampling : Float64? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = oversampling_validation_error(@oversampling)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(ignore, rescore, oversampling) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query.cr new file mode 100644 index 000000000000..ee99cad330f4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query.cr @@ -0,0 +1,120 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Query (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class Query + getter value + + def initialize(@value : ContextQuery) + end + def initialize(@value : DiscoverQuery) + end + def initialize(@value : FusionQuery) + end + def initialize(@value : NearestQuery) + end + def initialize(@value : OrderByQuery) + end + def initialize(@value : RecommendQuery) + end + def initialize(@value : SampleQuery) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + ContextQuery, DiscoverQuery, FusionQuery, NearestQuery, OrderByQuery, RecommendQuery, SampleQuery + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(ContextQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DiscoverQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(FusionQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(NearestQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(OrderByQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(RecommendQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(SampleQuery.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in Query (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(ContextQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DiscoverQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(FusionQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(NearestQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(OrderByQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(RecommendQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(SampleQuery.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in Query (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_batch_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_batch_points200_response.cr new file mode 100644 index 000000000000..678f21d41517 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_batch_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class QueryBatchPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Array(QueryResponse)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Array(QueryResponse)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_groups_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_groups_request.cr new file mode 100644 index 000000000000..9ddeec451ec4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_groups_request.cr @@ -0,0 +1,106 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class QueryGroupsRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. + @[JSON::Field(key: "group_by", emit_null: false)] + property group_by : String + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + @[JSON::Field(key: "prefetch", emit_null: false)] + property prefetch : QueryRequestPrefetch? + + # Query to perform. If missing without prefetches, returns points ordered by their IDs. + @[JSON::Field(key: "query", emit_null: false)] + property query : QueryInterface? + + # Define which vector name to use for querying. If missing, the default vector is used. + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + # Filter conditions - return only those points that satisfy the specified conditions. + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Search params for when there is no prefetch + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Return points with scores better than this threshold. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + # Options for specifying which vectors to include into the response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Options for specifying which payload to include or not. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection + @[JSON::Field(key: "lookup_from", emit_null: false)] + property lookup_from : LookupLocation? + + # Maximum amount of points to return per group. Default is 3. + @[JSON::Field(key: "group_size", emit_null: false)] + property group_size : Int32? + + # Maximum amount of groups to return. Default is 10. + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32? + + # Look for points in another collection using the group ids + @[JSON::Field(key: "with_lookup", emit_null: false)] + property with_lookup : WithLookupInterface? + + validates(group_by, String, false, min_length: 1) + validates(group_size, Int32, true, minimum: 1) + validates(limit, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@group_by : String, @shard_key : ShardKeySelector? = nil, @prefetch : QueryRequestPrefetch? = nil, @query : QueryInterface? = nil, @using : String? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @score_threshold : Float32? = nil, @with_vector : WithVector? = nil, @with_payload : WithPayloadInterface? = nil, @lookup_from : LookupLocation? = nil, @group_size : Int32? = nil, @limit : Int32? = nil, @with_lookup : WithLookupInterface? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = group_by_validation_error(@group_by)) + invalid_properties.push(msg) + end + if (msg = group_size_validation_error(@group_size)) + invalid_properties.push(msg) + end + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, prefetch, query, using, filter, params, score_threshold, with_vector, with_payload, lookup_from, group_by, group_size, limit, with_lookup) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_interface.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_interface.cr new file mode 100644 index 000000000000..c7fd67e13068 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_interface.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # QueryInterface (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class QueryInterface + getter value + + def initialize(@value : Query) + end + def initialize(@value : VectorInput) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Query, VectorInput + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Query.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(VectorInput.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in QueryInterface (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Query.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(VectorInput.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in QueryInterface (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_points200_response.cr new file mode 100644 index 000000000000..b2918d37addf --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class QueryPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : QueryResponse? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : QueryResponse? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request.cr new file mode 100644 index 000000000000..603a98a9d9a1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request.cr @@ -0,0 +1,93 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class QueryRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + @[JSON::Field(key: "prefetch", emit_null: false)] + property prefetch : QueryRequestPrefetch? + + # Query to perform. If missing without prefetches, returns points ordered by their IDs. + @[JSON::Field(key: "query", emit_null: false)] + property query : QueryInterface? + + # Define which vector name to use for querying. If missing, the default vector is used. + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + # Filter conditions - return only those points that satisfy the specified conditions. + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Search params for when there is no prefetch + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Return points with scores better than this threshold. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + # Max number of points to return. Default is 10. + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32? + + # Offset of the result. Skip this many points. Default is 0 + @[JSON::Field(key: "offset", emit_null: false)] + property offset : Int32? + + # Options for specifying which vectors to include into the response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Options for specifying which payload to include or not. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection + @[JSON::Field(key: "lookup_from", emit_null: false)] + property lookup_from : LookupLocation? + + validates(limit, Int32, true, minimum: 1) + validates(offset, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_key : ShardKeySelector? = nil, @prefetch : QueryRequestPrefetch? = nil, @query : QueryInterface? = nil, @using : String? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @score_threshold : Float32? = nil, @limit : Int32? = nil, @offset : Int32? = nil, @with_vector : WithVector? = nil, @with_payload : WithPayloadInterface? = nil, @lookup_from : LookupLocation? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + if (msg = offset_validation_error(@offset)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, prefetch, query, using, filter, params, score_threshold, limit, offset, with_vector, with_payload, lookup_from) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request_batch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request_batch.cr new file mode 100644 index 000000000000..99d69f3a656b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request_batch.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class QueryRequestBatch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "searches", emit_null: false)] + property searches : Array(QueryRequest) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@searches : Array(QueryRequest)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(searches) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request_prefetch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request_prefetch.cr new file mode 100644 index 000000000000..f46361882c8a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_request_prefetch.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es). + # QueryRequestPrefetch (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class QueryRequestPrefetch + getter value + + def initialize(@value : Array(Prefetch)) + end + def initialize(@value : Prefetch) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Prefetch), Prefetch + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Prefetch).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Prefetch.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in QueryRequestPrefetch (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Prefetch).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Prefetch.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in QueryRequestPrefetch (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_response.cr new file mode 100644 index 000000000000..7f0c467d3b61 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/query_response.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class QueryResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(ScoredPoint) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points : Array(ScoredPoint)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/raft_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/raft_info.cr new file mode 100644 index 000000000000..7f1806dcab1d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/raft_info.cr @@ -0,0 +1,81 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Summary information about the current raft state + class RaftInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Raft divides time into terms of arbitrary length, each beginning with an election. If a candidate wins the election, it remains the leader for the rest of the term. The term number increases monotonically. Each server stores the current term number which is also exchanged in every communication. + @[JSON::Field(key: "term", emit_null: false)] + property term : Int32 + + # The index of the latest committed (finalized) operation that this peer is aware of. + @[JSON::Field(key: "commit", emit_null: false)] + property commit : Int32 + + # Number of consensus operations pending to be applied on this peer + @[JSON::Field(key: "pending_operations", emit_null: false)] + property pending_operations : Int32 + + # Is this peer a voter or a learner + @[JSON::Field(key: "is_voter", emit_null: false)] + property is_voter : Bool + + # Optional properties + # Leader of the current term + @[JSON::Field(key: "leader", emit_null: false)] + property leader : Int32? + + # Role of this peer in the current term + @[JSON::Field(key: "role", emit_null: false)] + property role : StateRole? + + validates(term, Int32, false, minimum: 0) + validates(commit, Int32, false, minimum: 0) + validates(pending_operations, Int32, false, minimum: 0) + validates(leader, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@term : Int32, @commit : Int32, @pending_operations : Int32, @is_voter : Bool, @leader : Int32? = nil, @role : StateRole? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = term_validation_error(@term)) + invalid_properties.push(msg) + end + if (msg = commit_validation_error(@commit)) + invalid_properties.push(msg) + end + if (msg = pending_operations_validation_error(@pending_operations)) + invalid_properties.push(msg) + end + if (msg = leader_validation_error(@leader)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(term, commit, pending_operations, leader, role, is_voter) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/range.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/range.cr new file mode 100644 index 000000000000..bc59ced98154 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/range.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Range filter request + class Range + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # point.key < range.lt + @[JSON::Field(key: "lt", emit_null: false)] + property lt : Float64? + + # point.key > range.gt + @[JSON::Field(key: "gt", emit_null: false)] + property gt : Float64? + + # point.key >= range.gte + @[JSON::Field(key: "gte", emit_null: false)] + property gte : Float64? + + # point.key <= range.lte + @[JSON::Field(key: "lte", emit_null: false)] + property lte : Float64? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@lt : Float64? = nil, @gt : Float64? = nil, @gte : Float64? = nil, @lte : Float64? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(lt, gt, gte, lte) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/range_interface.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/range_interface.cr new file mode 100644 index 000000000000..9c403e0dfe0d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/range_interface.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # RangeInterface (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class RangeInterface + getter value + + def initialize(@value : DatetimeRange) + end + def initialize(@value : Range) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + DatetimeRange, Range + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(DatetimeRange.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Range.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in RangeInterface (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(DatetimeRange.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Range.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in RangeInterface (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/read_consistency.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/read_consistency.cr new file mode 100644 index 000000000000..ae4d47c50c4f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/read_consistency.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Read consistency parameter Defines how many replicas should be queried to get the result * `N` - send N random request and return points, which present on all of them * `majority` - send N/2+1 random request and return points, which present on all of them * `quorum` - send requests to all nodes and return points which present on majority of them * `all` - send requests to all nodes and return points which present on all of them Default value is `Factor(1)` + # ReadConsistency (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ReadConsistency + getter value + + def initialize(@value : Int32) + end + def initialize(@value : ReadConsistencyType) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Int32, ReadConsistencyType + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Int32.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ReadConsistencyType.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ReadConsistency (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Int32.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ReadConsistencyType.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ReadConsistency (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/read_consistency_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/read_consistency_type.cr new file mode 100644 index 000000000000..a16fea011387 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/read_consistency_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ReadConsistencyType (OpenAPI enum). Allowed values: "majority", "quorum", "all". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ReadConsistencyType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_example.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_example.cr new file mode 100644 index 000000000000..aec3f22075fd --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_example.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # RecommendExample (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class RecommendExample + getter value + + def initialize(@value : Array(Float32)) + end + def initialize(@value : ExtendedPointId) + end + def initialize(@value : SparseVector) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Float32), ExtendedPointId, SparseVector + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Float32).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ExtendedPointId.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(SparseVector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in RecommendExample (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Float32).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ExtendedPointId.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(SparseVector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in RecommendExample (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_groups_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_groups_request.cr new file mode 100644 index 000000000000..17d2d5b6c93c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_groups_request.cr @@ -0,0 +1,112 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RecommendGroupsRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. + @[JSON::Field(key: "group_by", emit_null: false)] + property group_by : String + + # Maximum amount of points to return per group + @[JSON::Field(key: "group_size", emit_null: false)] + property group_size : Int32 + + # Maximum amount of groups to return + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32 + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look for vectors closest to those + @[JSON::Field(key: "positive", emit_null: false)] + property positive : Array(RecommendExample)? + + # Try to avoid vectors like this + @[JSON::Field(key: "negative", emit_null: false)] + property negative : Array(RecommendExample)? + + # How to use positive and negative examples to find the results + @[JSON::Field(key: "strategy", emit_null: false)] + property strategy : RecommendStrategy? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Additional search params + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Select which payload to return with the response. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # Options for specifying which vectors to include into response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + # Define which vector to use for recommendation, if not specified - try to use default vector + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + # The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection + @[JSON::Field(key: "lookup_from", emit_null: false)] + property lookup_from : LookupLocation? + + # Look for points in another collection using the group ids + @[JSON::Field(key: "with_lookup", emit_null: false)] + property with_lookup : WithLookupInterface? + + validates(group_by, String, false, min_length: 1) + validates(group_size, Int32, false, minimum: 1) + validates(limit, Int32, false, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@group_by : String, @group_size : Int32, @limit : Int32, @shard_key : ShardKeySelector? = nil, @positive : Array(RecommendExample)? = nil, @negative : Array(RecommendExample)? = nil, @strategy : RecommendStrategy? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil, @score_threshold : Float32? = nil, @using : String? = nil, @lookup_from : LookupLocation? = nil, @with_lookup : WithLookupInterface? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = group_by_validation_error(@group_by)) + invalid_properties.push(msg) + end + if (msg = group_size_validation_error(@group_size)) + invalid_properties.push(msg) + end + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, positive, negative, strategy, filter, params, with_payload, with_vector, score_threshold, using, lookup_from, group_by, group_size, limit, with_lookup) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_input.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_input.cr new file mode 100644 index 000000000000..abdb9dac5217 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_input.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RecommendInput + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Look for vectors closest to the vectors from these points + @[JSON::Field(key: "positive", emit_null: false)] + property positive : Array(VectorInput)? + + # Try to avoid vectors like the vector from these points + @[JSON::Field(key: "negative", emit_null: false)] + property negative : Array(VectorInput)? + + # How to use the provided vectors to find the results + @[JSON::Field(key: "strategy", emit_null: false)] + property strategy : RecommendStrategy? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@positive : Array(VectorInput)? = nil, @negative : Array(VectorInput)? = nil, @strategy : RecommendStrategy? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(positive, negative, strategy) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_query.cr new file mode 100644 index 000000000000..60e98143c314 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RecommendQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "recommend", emit_null: false)] + property recommend : RecommendInput + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@recommend : RecommendInput) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(recommend) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_request.cr new file mode 100644 index 000000000000..5bb4f2302f70 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_request.cr @@ -0,0 +1,101 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Recommendation request. Provides positive and negative examples of the vectors, which can be ids of points that are already stored in the collection, raw vectors, or even ids and vectors combined. Service should look for the points which are closer to positive examples and at the same time further to negative examples. The concrete way of how to compare negative and positive distances is up to the `strategy` chosen. + class RecommendRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Max number of result to return + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32 + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look for vectors closest to those + @[JSON::Field(key: "positive", emit_null: false)] + property positive : Array(RecommendExample)? + + # Try to avoid vectors like this + @[JSON::Field(key: "negative", emit_null: false)] + property negative : Array(RecommendExample)? + + # How to use positive and negative examples to find the results + @[JSON::Field(key: "strategy", emit_null: false)] + property strategy : RecommendStrategy? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Additional search params + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues. + @[JSON::Field(key: "offset", emit_null: false)] + property offset : Int32? + + # Select which payload to return with the response. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # Options for specifying which vectors to include into response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + # Define which vector to use for recommendation, if not specified - try to use default vector + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + # The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection + @[JSON::Field(key: "lookup_from", emit_null: false)] + property lookup_from : LookupLocation? + + validates(limit, Int32, false, minimum: 1) + validates(offset, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@limit : Int32, @shard_key : ShardKeySelector? = nil, @positive : Array(RecommendExample)? = nil, @negative : Array(RecommendExample)? = nil, @strategy : RecommendStrategy? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @offset : Int32? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil, @score_threshold : Float32? = nil, @using : String? = nil, @lookup_from : LookupLocation? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + if (msg = offset_validation_error(@offset)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, positive, negative, strategy, filter, params, limit, offset, with_payload, with_vector, score_threshold, using, lookup_from) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_request_batch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_request_batch.cr new file mode 100644 index 000000000000..6a0577351aa7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_request_batch.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RecommendRequestBatch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "searches", emit_null: false)] + property searches : Array(RecommendRequest) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@searches : Array(RecommendRequest)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(searches) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_strategy.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_strategy.cr new file mode 100644 index 000000000000..f43f03a054a9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recommend_strategy.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # RecommendStrategy (OpenAPI enum). Allowed values: "average_vector", "best_score". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias RecommendStrategy = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/record.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/record.cr new file mode 100644 index 000000000000..d4124a86e4e3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/record.cr @@ -0,0 +1,59 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Point data + class Record + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : ExtendedPointId + + # Optional properties + # Payload - values assigned to the point + @[JSON::Field(key: "payload", emit_null: false)] + property payload : Hash(String, JSON::Any)? + + # Vector of the point + @[JSON::Field(key: "vector", emit_null: false)] + property vector : VectorStruct? + + # Shard Key + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey? + + @[JSON::Field(key: "order_value", emit_null: false)] + property order_value : OrderValue? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : ExtendedPointId, @payload : Hash(String, JSON::Any)? = nil, @vector : VectorStruct? = nil, @shard_key : ShardKey? = nil, @order_value : OrderValue? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, payload, vector, shard_key, order_value) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/recover_from_uploaded_snapshot202_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recover_from_uploaded_snapshot202_response.cr new file mode 100644 index 000000000000..3b16f832a04b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/recover_from_uploaded_snapshot202_response.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RecoverFromUploadedSnapshot202Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/remote_shard_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/remote_shard_info.cr new file mode 100644 index 000000000000..f64a3a682648 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/remote_shard_info.cr @@ -0,0 +1,63 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RemoteShardInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Remote shard id + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + # Remote peer id + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32 + + @[JSON::Field(key: "state", emit_null: false)] + property state : ReplicaState + + # Optional properties + # User-defined sharding key + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey? + + validates(shard_id, Int32, false, minimum: 0) + validates(peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @peer_id : Int32, @state : ReplicaState, @shard_key : ShardKey? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, shard_key, peer_id, state) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/remote_shard_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/remote_shard_telemetry.cr new file mode 100644 index 000000000000..9656a5950d30 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/remote_shard_telemetry.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RemoteShardTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "searches", emit_null: false)] + property searches : OperationDurationStatistics + + @[JSON::Field(key: "updates", emit_null: false)] + property updates : OperationDurationStatistics + + # Optional properties + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32? + + validates(shard_id, Int32, false, minimum: 0) + validates(peer_id, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @searches : OperationDurationStatistics, @updates : OperationDurationStatistics, @peer_id : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, peer_id, searches, updates) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/rename_alias.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/rename_alias.cr new file mode 100644 index 000000000000..ba7a25223396 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/rename_alias.cr @@ -0,0 +1,46 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Change alias to a new one + class RenameAlias + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "old_alias_name", emit_null: false)] + property old_alias_name : String + + @[JSON::Field(key: "new_alias_name", emit_null: false)] + property new_alias_name : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@old_alias_name : String, @new_alias_name : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(old_alias_name, new_alias_name) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/rename_alias_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/rename_alias_operation.cr new file mode 100644 index 000000000000..746ca84eb949 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/rename_alias_operation.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Change alias to a new one + class RenameAliasOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "rename_alias", emit_null: false)] + property rename_alias : RenameAlias + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@rename_alias : RenameAlias) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(rename_alias) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica.cr new file mode 100644 index 000000000000..3c3b41a15b9d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica.cr @@ -0,0 +1,53 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Replica + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32 + + validates(shard_id, Int32, false, minimum: 0) + validates(peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @peer_id : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, peer_id) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica_set_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica_set_telemetry.cr new file mode 100644 index 000000000000..0d0673788b9a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica_set_telemetry.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ReplicaSetTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : Int32 + + @[JSON::Field(key: "remote", emit_null: false)] + property remote : Array(RemoteShardTelemetry) + + @[JSON::Field(key: "replicate_states", emit_null: false)] + property replicate_states : Hash(String, ReplicaState) + + # Optional properties + @[JSON::Field(key: "local", emit_null: false)] + property local : LocalShardTelemetry? + + validates(id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : Int32, @remote : Array(RemoteShardTelemetry), @replicate_states : Hash(String, ReplicaState), @local : LocalShardTelemetry? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = id_validation_error(@id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, local, remote, replicate_states) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica_state.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica_state.cr new file mode 100644 index 000000000000..4619a5f2ad6a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replica_state.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ReplicaState (OpenAPI enum). Allowed values: "Active", "Dead", "Partial", "Initializing", "Listener", "PartialSnapshot", "Recovery". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ReplicaState = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/replicate_shard.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replicate_shard.cr new file mode 100644 index 000000000000..bc8a9ea03731 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replicate_shard.cr @@ -0,0 +1,65 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ReplicateShard + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "to_peer_id", emit_null: false)] + property to_peer_id : Int32 + + @[JSON::Field(key: "from_peer_id", emit_null: false)] + property from_peer_id : Int32 + + # Optional properties + # Method for transferring the shard from one node to another + @[JSON::Field(key: "method", emit_null: false)] + property method : ShardTransferMethod? + + validates(shard_id, Int32, false, minimum: 0) + validates(to_peer_id, Int32, false, minimum: 0) + validates(from_peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @to_peer_id : Int32, @from_peer_id : Int32, @method : ShardTransferMethod? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = to_peer_id_validation_error(@to_peer_id)) + invalid_properties.push(msg) + end + if (msg = from_peer_id_validation_error(@from_peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, to_peer_id, from_peer_id, method) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/replicate_shard_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replicate_shard_operation.cr new file mode 100644 index 000000000000..dd6e75c1e99f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/replicate_shard_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ReplicateShardOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "replicate_shard", emit_null: false)] + property replicate_shard : ReplicateShard + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@replicate_shard : ReplicateShard) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(replicate_shard) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/requests_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/requests_telemetry.cr new file mode 100644 index 000000000000..3fffce818019 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/requests_telemetry.cr @@ -0,0 +1,45 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RequestsTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "rest", emit_null: false)] + property rest : WebApiTelemetry + + @[JSON::Field(key: "grpc", emit_null: false)] + property grpc : GrpcTelemetry + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@rest : WebApiTelemetry, @grpc : GrpcTelemetry) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(rest, grpc) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/resharding_direction.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/resharding_direction.cr new file mode 100644 index 000000000000..bf33e6392160 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/resharding_direction.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ReshardingDirection (OpenAPI enum). Allowed values: "up", "down". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ReshardingDirection = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/resharding_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/resharding_info.cr new file mode 100644 index 000000000000..049c0ca36dd7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/resharding_info.cr @@ -0,0 +1,64 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ReshardingInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "direction", emit_null: false)] + property direction : ReshardingDirection + + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "peer_id", emit_null: false)] + property peer_id : Int32 + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey? + + # A human-readable report of the operation progress. Available only on the source peer. + @[JSON::Field(key: "comment", emit_null: false)] + property comment : String? + + validates(shard_id, Int32, false, minimum: 0) + validates(peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@direction : ReshardingDirection, @shard_id : Int32, @peer_id : Int32, @shard_key : ShardKey? = nil, @comment : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = peer_id_validation_error(@peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(direction, shard_id, peer_id, shard_key, comment) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/restart_transfer.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/restart_transfer.cr new file mode 100644 index 000000000000..d6ef43f5d7c3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/restart_transfer.cr @@ -0,0 +1,63 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RestartTransfer + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + @[JSON::Field(key: "from_peer_id", emit_null: false)] + property from_peer_id : Int32 + + @[JSON::Field(key: "to_peer_id", emit_null: false)] + property to_peer_id : Int32 + + @[JSON::Field(key: "method", emit_null: false)] + property method : ShardTransferMethod + + validates(shard_id, Int32, false, minimum: 0) + validates(from_peer_id, Int32, false, minimum: 0) + validates(to_peer_id, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @from_peer_id : Int32, @to_peer_id : Int32, @method : ShardTransferMethod) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = from_peer_id_validation_error(@from_peer_id)) + invalid_properties.push(msg) + end + if (msg = to_peer_id_validation_error(@to_peer_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, from_peer_id, to_peer_id, method) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/restart_transfer_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/restart_transfer_operation.cr new file mode 100644 index 000000000000..dcc770a5bdf8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/restart_transfer_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RestartTransferOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "restart_transfer", emit_null: false)] + property restart_transfer : RestartTransfer + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@restart_transfer : RestartTransfer) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(restart_transfer) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/running_environment_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/running_environment_telemetry.cr new file mode 100644 index 000000000000..da27830e5b2d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/running_environment_telemetry.cr @@ -0,0 +1,73 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class RunningEnvironmentTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "is_docker", emit_null: false)] + property is_docker : Bool + + @[JSON::Field(key: "cpu_flags", emit_null: false)] + property cpu_flags : String + + # Optional properties + @[JSON::Field(key: "distribution", emit_null: false)] + property distribution : String? + + @[JSON::Field(key: "distribution_version", emit_null: false)] + property distribution_version : String? + + @[JSON::Field(key: "cores", emit_null: false)] + property cores : Int32? + + @[JSON::Field(key: "ram_size", emit_null: false)] + property ram_size : Int32? + + @[JSON::Field(key: "disk_size", emit_null: false)] + property disk_size : Int32? + + validates(cores, Int32, true, minimum: 0) + validates(ram_size, Int32, true, minimum: 0) + validates(disk_size, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@is_docker : Bool, @cpu_flags : String, @distribution : String? = nil, @distribution_version : String? = nil, @cores : Int32? = nil, @ram_size : Int32? = nil, @disk_size : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = cores_validation_error(@cores)) + invalid_properties.push(msg) + end + if (msg = ram_size_validation_error(@ram_size)) + invalid_properties.push(msg) + end + if (msg = disk_size_validation_error(@disk_size)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(distribution, distribution_version, is_docker, cores, ram_size, disk_size, cpu_flags) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sample.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sample.cr new file mode 100644 index 000000000000..6934e8f822ab --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sample.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Sample (OpenAPI enum). Allowed values: "random". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias Sample = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sample_query.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sample_query.cr new file mode 100644 index 000000000000..e87f48c4003c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sample_query.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SampleQuery + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "sample", emit_null: false)] + property sample : Sample + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@sample : Sample) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(sample) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_quantization.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_quantization.cr new file mode 100644 index 000000000000..ca2f38c6f363 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_quantization.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ScalarQuantization + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "scalar", emit_null: false)] + property scalar : ScalarQuantizationConfig + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@scalar : ScalarQuantizationConfig) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(scalar) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_quantization_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_quantization_config.cr new file mode 100644 index 000000000000..f48d8c22a839 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_quantization_config.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ScalarQuantizationConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : ScalarType + + # Optional properties + # Quantile for quantization. Expected value range in [0.5, 1.0]. If not set - use the whole range of values + @[JSON::Field(key: "quantile", emit_null: false)] + property quantile : Float32? + + # If true - quantized vectors always will be stored in RAM, ignoring the config of main storage + @[JSON::Field(key: "always_ram", emit_null: false)] + property always_ram : Bool? + + validates(quantile, Float32, true, maximum: 1, minimum: 0.5) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : ScalarType, @quantile : Float32? = nil, @always_ram : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = quantile_validation_error(@quantile)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, quantile, always_ram) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_type.cr new file mode 100644 index 000000000000..df897de7896d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scalar_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ScalarType (OpenAPI enum). Allowed values: "int8". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ScalarType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scored_point.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scored_point.cr new file mode 100644 index 000000000000..67b0a79e58a9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scored_point.cr @@ -0,0 +1,72 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Search result + class ScoredPoint + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : ExtendedPointId + + # Point version + @[JSON::Field(key: "version", emit_null: false)] + property version : Int32 + + # Points vector distance to the query vector + @[JSON::Field(key: "score", emit_null: false)] + property score : Float32 + + # Optional properties + # Payload - values assigned to the point + @[JSON::Field(key: "payload", emit_null: false)] + property payload : Hash(String, JSON::Any)? + + # Vector of the point + @[JSON::Field(key: "vector", emit_null: false)] + property vector : VectorStruct? + + # Shard Key + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKey? + + # Order-by value + @[JSON::Field(key: "order_value", emit_null: false)] + property order_value : OrderValue? + + validates(version, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : ExtendedPointId, @version : Int32, @score : Float32, @payload : Hash(String, JSON::Any)? = nil, @vector : VectorStruct? = nil, @shard_key : ShardKey? = nil, @order_value : OrderValue? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = version_validation_error(@version)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, version, score, payload, vector, shard_key, order_value) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_points200_response.cr new file mode 100644 index 000000000000..e816dfe7faa6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ScrollPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : ScrollResult? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : ScrollResult? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_request.cr new file mode 100644 index 000000000000..abeb1c7b12d5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_request.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Scroll request - paginate over all points which matches given condition + class ScrollRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Start ID to read points from. + @[JSON::Field(key: "offset", emit_null: false)] + property offset : ExtendedPointId? + + # Page size. Default: 10 + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32? + + # Look only for points which satisfies this conditions. If not provided - all points. + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Select which payload to return with the response. Default is true. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Order the records by a payload field. + @[JSON::Field(key: "order_by", emit_null: false)] + property order_by : OrderByInterface? + + validates(limit, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_key : ShardKeySelector? = nil, @offset : ExtendedPointId? = nil, @limit : Int32? = nil, @filter : Filter? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil, @order_by : OrderByInterface? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, offset, limit, filter, with_payload, with_vector, order_by) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_result.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_result.cr new file mode 100644 index 000000000000..ac167b35b796 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/scroll_result.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Result of the points read request + class ScrollResult + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # List of retrieved points + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(Record) + + # Optional properties + # Offset which should be used to retrieve a next page result + @[JSON::Field(key: "next_page_offset", emit_null: false)] + property next_page_offset : ExtendedPointId? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points : Array(Record), @next_page_offset : ExtendedPointId? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points, next_page_offset) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_batch_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_batch_points200_response.cr new file mode 100644 index 000000000000..28b6978b76e6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_batch_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchBatchPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Array(Array(ScoredPoint))? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Array(Array(ScoredPoint))? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_groups_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_groups_request.cr new file mode 100644 index 000000000000..f276b9cc47ec --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_groups_request.cr @@ -0,0 +1,95 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchGroupsRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "vector", emit_null: false)] + property vector : NamedVectorStruct + + # Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. + @[JSON::Field(key: "group_by", emit_null: false)] + property group_by : String + + # Maximum amount of points to return per group + @[JSON::Field(key: "group_size", emit_null: false)] + property group_size : Int32 + + # Maximum amount of groups to return + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32 + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Additional search params + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Select which payload to return with the response. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # Options for specifying which vectors to include into response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + # Look for points in another collection using the group ids + @[JSON::Field(key: "with_lookup", emit_null: false)] + property with_lookup : WithLookupInterface? + + validates(group_by, String, false, min_length: 1) + validates(group_size, Int32, false, minimum: 1) + validates(limit, Int32, false, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vector : NamedVectorStruct, @group_by : String, @group_size : Int32, @limit : Int32, @shard_key : ShardKeySelector? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil, @score_threshold : Float32? = nil, @with_lookup : WithLookupInterface? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = group_by_validation_error(@group_by)) + invalid_properties.push(msg) + end + if (msg = group_size_validation_error(@group_size)) + invalid_properties.push(msg) + end + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, vector, filter, params, with_payload, with_vector, score_threshold, group_by, group_size, limit, with_lookup) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_offsets200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_offsets200_response.cr new file mode 100644 index 000000000000..228f77c9deb5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_offsets200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchMatrixOffsets200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : SearchMatrixOffsetsResponse? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : SearchMatrixOffsetsResponse? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_offsets_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_offsets_response.cr new file mode 100644 index 000000000000..b4ccf98de2e6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_offsets_response.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchMatrixOffsetsResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Row indices of the matrix + @[JSON::Field(key: "offsets_row", emit_null: false)] + property offsets_row : Array(Int32) + + # Column indices of the matrix + @[JSON::Field(key: "offsets_col", emit_null: false)] + property offsets_col : Array(Int32) + + # Scores associated with matrix coordinates + @[JSON::Field(key: "scores", emit_null: false)] + property scores : Array(Float32) + + # Ids of the points in order + @[JSON::Field(key: "ids", emit_null: false)] + property ids : Array(ExtendedPointId) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@offsets_row : Array(Int32), @offsets_col : Array(Int32), @scores : Array(Float32), @ids : Array(ExtendedPointId)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(offsets_row, offsets_col, scores, ids) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pair.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pair.cr new file mode 100644 index 000000000000..4688f7b90b35 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pair.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Pair of points (a, b) with score + class SearchMatrixPair + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "a", emit_null: false)] + property a : ExtendedPointId + + @[JSON::Field(key: "b", emit_null: false)] + property b : ExtendedPointId + + @[JSON::Field(key: "score", emit_null: false)] + property score : Float32 + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@a : ExtendedPointId, @b : ExtendedPointId, @score : Float32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(a, b, score) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pairs200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pairs200_response.cr new file mode 100644 index 000000000000..8d1a049f4818 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pairs200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchMatrixPairs200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : SearchMatrixPairsResponse? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : SearchMatrixPairsResponse? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pairs_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pairs_response.cr new file mode 100644 index 000000000000..3a9f086c32dc --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_pairs_response.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchMatrixPairsResponse + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # List of pairs of points with scores + @[JSON::Field(key: "pairs", emit_null: false)] + property pairs : Array(SearchMatrixPair) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@pairs : Array(SearchMatrixPair)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(pairs) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_request.cr new file mode 100644 index 000000000000..c4b2142011ec --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_matrix_request.cr @@ -0,0 +1,67 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchMatrixRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # How many points to select and search within. Default is 10. + @[JSON::Field(key: "sample", emit_null: false)] + property sample : Int32? + + # How many neighbours per sample to find. Default is 3. + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32? + + # Define which vector name to use for querying. If missing, the default vector is used. + @[JSON::Field(key: "using", emit_null: false)] + property using : String? + + validates(sample, Int32, true, minimum: 2) + validates(limit, Int32, true, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_key : ShardKeySelector? = nil, @filter : Filter? = nil, @sample : Int32? = nil, @limit : Int32? = nil, @using : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = sample_validation_error(@sample)) + invalid_properties.push(msg) + end + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, filter, sample, limit, using) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_params.cr new file mode 100644 index 000000000000..bfbef287a7e2 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_params.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Additional parameters of the search + class SearchParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Params relevant to HNSW index Size of the beam in a beam-search. Larger the value - more accurate the result, more time required for search. + @[JSON::Field(key: "hnsw_ef", emit_null: false)] + property hnsw_ef : Int32? + + # Search without approximation. If set to true, search may run long but with exact results. + @[JSON::Field(key: "exact", emit_null: false)] + property exact : Bool? = false + + # Quantization params + @[JSON::Field(key: "quantization", emit_null: false)] + property quantization : QuantizationSearchParams? + + # If enabled, the engine will only perform search among indexed or small segments. Using this option prevents slow searches in case of delayed index, but does not guarantee that all uploaded vectors will be included in search results + @[JSON::Field(key: "indexed_only", emit_null: false)] + property indexed_only : Bool? = false + + validates(hnsw_ef, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@hnsw_ef : Int32? = nil, @exact : Bool? = false, @quantization : QuantizationSearchParams? = nil, @indexed_only : Bool? = false) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = hnsw_ef_validation_error(@hnsw_ef)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(hnsw_ef, exact, quantization, indexed_only) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_point_groups200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_point_groups200_response.cr new file mode 100644 index 000000000000..f8c083726b12 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_point_groups200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchPointGroups200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : GroupsResult? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : GroupsResult? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_points200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_points200_response.cr new file mode 100644 index 000000000000..babecf88ac52 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_points200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchPoints200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : Array(ScoredPoint)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : Array(ScoredPoint)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_request.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_request.cr new file mode 100644 index 000000000000..e5a2b137b60e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_request.cr @@ -0,0 +1,84 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Search request. Holds all conditions and parameters for the search of most similar points by vector similarity given the filtering restrictions. + class SearchRequest + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "vector", emit_null: false)] + property vector : NamedVectorStruct + + # Max number of result to return + @[JSON::Field(key: "limit", emit_null: false)] + property limit : Int32 + + # Optional properties + # Specify in which shards to look for the points, if not specified - look in all shards + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Look only for points which satisfies this conditions + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + # Additional search params + @[JSON::Field(key: "params", emit_null: false)] + property params : SearchParams? + + # Offset of the first result to return. May be used to paginate results. Note: large offset values may cause performance issues. + @[JSON::Field(key: "offset", emit_null: false)] + property offset : Int32? + + # Select which payload to return with the response. Default is false. + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # Options for specifying which vectors to include into response. Default is false. + @[JSON::Field(key: "with_vector", emit_null: false)] + property with_vector : WithVector? + + # Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. + @[JSON::Field(key: "score_threshold", emit_null: false)] + property score_threshold : Float32? + + validates(limit, Int32, false, minimum: 1) + validates(offset, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vector : NamedVectorStruct, @limit : Int32, @shard_key : ShardKeySelector? = nil, @filter : Filter? = nil, @params : SearchParams? = nil, @offset : Int32? = nil, @with_payload : WithPayloadInterface? = nil, @with_vector : WithVector? = nil, @score_threshold : Float32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = limit_validation_error(@limit)) + invalid_properties.push(msg) + end + if (msg = offset_validation_error(@offset)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_key, vector, filter, params, limit, offset, with_payload, with_vector, score_threshold) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_request_batch.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_request_batch.cr new file mode 100644 index 000000000000..08249d3e7b8d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/search_request_batch.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SearchRequestBatch + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "searches", emit_null: false)] + property searches : Array(SearchRequest) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@searches : Array(SearchRequest)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(searches) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_config.cr new file mode 100644 index 000000000000..4ddc34780abe --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_config.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SegmentConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "payload_storage_type", emit_null: false)] + property payload_storage_type : PayloadStorageType + + # Optional properties + @[JSON::Field(key: "vector_data", emit_null: false)] + property vector_data : Hash(String, VectorDataConfig)? + + @[JSON::Field(key: "sparse_vector_data", emit_null: false)] + property sparse_vector_data : Hash(String, SparseVectorDataConfig)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@payload_storage_type : PayloadStorageType, @vector_data : Hash(String, VectorDataConfig)? = nil, @sparse_vector_data : Hash(String, SparseVectorDataConfig)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(vector_data, sparse_vector_data, payload_storage_type) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_info.cr new file mode 100644 index 000000000000..a91053bb4796 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_info.cr @@ -0,0 +1,94 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Aggregated information about segment + class SegmentInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "segment_type", emit_null: false)] + property segment_type : SegmentType + + @[JSON::Field(key: "num_vectors", emit_null: false)] + property num_vectors : Int32 + + @[JSON::Field(key: "num_points", emit_null: false)] + property num_points : Int32 + + @[JSON::Field(key: "num_indexed_vectors", emit_null: false)] + property num_indexed_vectors : Int32 + + @[JSON::Field(key: "num_deleted_vectors", emit_null: false)] + property num_deleted_vectors : Int32 + + @[JSON::Field(key: "ram_usage_bytes", emit_null: false)] + property ram_usage_bytes : Int32 + + @[JSON::Field(key: "disk_usage_bytes", emit_null: false)] + property disk_usage_bytes : Int32 + + @[JSON::Field(key: "is_appendable", emit_null: false)] + property is_appendable : Bool + + @[JSON::Field(key: "index_schema", emit_null: false)] + property index_schema : Hash(String, PayloadIndexInfo) + + @[JSON::Field(key: "vector_data", emit_null: false)] + property vector_data : Hash(String, VectorDataInfo) + + validates(num_vectors, Int32, false, minimum: 0) + validates(num_points, Int32, false, minimum: 0) + validates(num_indexed_vectors, Int32, false, minimum: 0) + validates(num_deleted_vectors, Int32, false, minimum: 0) + validates(ram_usage_bytes, Int32, false, minimum: 0) + validates(disk_usage_bytes, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@segment_type : SegmentType, @num_vectors : Int32, @num_points : Int32, @num_indexed_vectors : Int32, @num_deleted_vectors : Int32, @ram_usage_bytes : Int32, @disk_usage_bytes : Int32, @is_appendable : Bool, @index_schema : Hash(String, PayloadIndexInfo), @vector_data : Hash(String, VectorDataInfo)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = num_vectors_validation_error(@num_vectors)) + invalid_properties.push(msg) + end + if (msg = num_points_validation_error(@num_points)) + invalid_properties.push(msg) + end + if (msg = num_indexed_vectors_validation_error(@num_indexed_vectors)) + invalid_properties.push(msg) + end + if (msg = num_deleted_vectors_validation_error(@num_deleted_vectors)) + invalid_properties.push(msg) + end + if (msg = ram_usage_bytes_validation_error(@ram_usage_bytes)) + invalid_properties.push(msg) + end + if (msg = disk_usage_bytes_validation_error(@disk_usage_bytes)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(segment_type, num_vectors, num_points, num_indexed_vectors, num_deleted_vectors, ram_usage_bytes, disk_usage_bytes, is_appendable, index_schema, vector_data) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_telemetry.cr new file mode 100644 index 000000000000..5190552a703d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_telemetry.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SegmentTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "info", emit_null: false)] + property info : SegmentInfo + + @[JSON::Field(key: "config", emit_null: false)] + property config : SegmentConfig + + @[JSON::Field(key: "vector_index_searches", emit_null: false)] + property vector_index_searches : Array(VectorIndexSearchesTelemetry) + + @[JSON::Field(key: "payload_field_indices", emit_null: false)] + property payload_field_indices : Array(PayloadIndexTelemetry) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@info : SegmentInfo, @config : SegmentConfig, @vector_index_searches : Array(VectorIndexSearchesTelemetry), @payload_field_indices : Array(PayloadIndexTelemetry)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(info, config, vector_index_searches, payload_field_indices) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_type.cr new file mode 100644 index 000000000000..03dd3f8035c5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/segment_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # SegmentType (OpenAPI enum). Allowed values: "plain", "indexed", "special". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias SegmentType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/set_payload.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/set_payload.cr new file mode 100644 index 000000000000..4fdb956e1611 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/set_payload.cr @@ -0,0 +1,59 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # This data structure is used in API interface and applied across multiple shards + class SetPayload + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "payload", emit_null: false)] + property payload : Hash(String, JSON::Any) + + # Optional properties + # Assigns payload to each point in this list + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(ExtendedPointId)? + + # Assigns payload to each point that satisfy this filter condition + @[JSON::Field(key: "filter", emit_null: false)] + property filter : Filter? + + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + # Assigns payload to each point that satisfy this path of property + @[JSON::Field(key: "key", emit_null: false)] + property key : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@payload : Hash(String, JSON::Any), @points : Array(ExtendedPointId)? = nil, @filter : Filter? = nil, @shard_key : ShardKeySelector? = nil, @key : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(payload, points, filter, shard_key, key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/set_payload_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/set_payload_operation.cr new file mode 100644 index 000000000000..21040ead68d3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/set_payload_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SetPayloadOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "set_payload", emit_null: false)] + property set_payload : SetPayload + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@set_payload : SetPayload) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(set_payload) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_key.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_key.cr new file mode 100644 index 000000000000..7620e5e13e8e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_key.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ShardKey (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ShardKey + getter value + + def initialize(@value : Int32) + end + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Int32, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Int32.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ShardKey (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Int32.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ShardKey (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_key_selector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_key_selector.cr new file mode 100644 index 000000000000..870f130677f8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_key_selector.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ShardKeySelector (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ShardKeySelector + getter value + + def initialize(@value : Array(ShardKey)) + end + def initialize(@value : ShardKey) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(ShardKey), ShardKey + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(ShardKey).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ShardKey.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ShardKeySelector (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(ShardKey).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ShardKey.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ShardKeySelector (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_snapshot_location.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_snapshot_location.cr new file mode 100644 index 000000000000..031707b0915b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_snapshot_location.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ShardSnapshotLocation (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ShardSnapshotLocation + getter value + + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ShardSnapshotLocation (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ShardSnapshotLocation (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_snapshot_recover.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_snapshot_recover.cr new file mode 100644 index 000000000000..5b842115ea1d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_snapshot_recover.cr @@ -0,0 +1,54 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ShardSnapshotRecover + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "location", emit_null: false)] + property location : ShardSnapshotLocation + + # Optional properties + @[JSON::Field(key: "priority", emit_null: false)] + property priority : SnapshotPriority? + + # Optional SHA256 checksum to verify snapshot integrity before recovery. + @[JSON::Field(key: "checksum", emit_null: false)] + property checksum : String? + + # Optional API key used when fetching the snapshot from a remote URL. + @[JSON::Field(key: "api_key", emit_null: false)] + property api_key : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@location : ShardSnapshotLocation, @priority : SnapshotPriority? = nil, @checksum : String? = nil, @api_key : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(location, priority, checksum, api_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_status.cr new file mode 100644 index 000000000000..794522b557aa --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_status.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ShardStatus (OpenAPI enum). Allowed values: "green", "yellow", "grey", "red". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ShardStatus = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_transfer_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_transfer_info.cr new file mode 100644 index 000000000000..dd6624e58fb1 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_transfer_info.cr @@ -0,0 +1,74 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class ShardTransferInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "shard_id", emit_null: false)] + property shard_id : Int32 + + # Source peer id + @[JSON::Field(key: "from", emit_null: false)] + property from : Int32 + + # Destination peer id + @[JSON::Field(key: "to", emit_null: false)] + property to : Int32 + + # If `true` transfer is a synchronization of a replicas If `false` transfer is a moving of a shard from one peer to another + @[JSON::Field(key: "sync", emit_null: false)] + property sync : Bool + + # Optional properties + @[JSON::Field(key: "method", emit_null: false)] + property method : ShardTransferMethod? + + # A human-readable report of the transfer progress. Available only on the source peer. + @[JSON::Field(key: "comment", emit_null: false)] + property comment : String? + + validates(shard_id, Int32, false, minimum: 0) + validates(from, Int32, false, minimum: 0) + validates(to, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@shard_id : Int32, @from : Int32, @to : Int32, @sync : Bool, @method : ShardTransferMethod? = nil, @comment : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = shard_id_validation_error(@shard_id)) + invalid_properties.push(msg) + end + if (msg = from_validation_error(@from)) + invalid_properties.push(msg) + end + if (msg = to_validation_error(@to)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(shard_id, from, to, sync, method, comment) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_transfer_method.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_transfer_method.cr new file mode 100644 index 000000000000..c0984c6ce658 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/shard_transfer_method.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ShardTransferMethod (OpenAPI enum). Allowed values: "stream_records", "snapshot", "wal_delta". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ShardTransferMethod = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sharding_method.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sharding_method.cr new file mode 100644 index 000000000000..ea1a8bc21511 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sharding_method.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ShardingMethod (OpenAPI enum). Allowed values: "auto", "custom". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias ShardingMethod = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_description.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_description.cr new file mode 100644 index 000000000000..ff47da8da851 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_description.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SnapshotDescription + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "name", emit_null: false)] + property name : String + + @[JSON::Field(key: "size", emit_null: false)] + property size : Int32 + + # Optional properties + @[JSON::Field(key: "creation_time", emit_null: false)] + property creation_time : String? + + @[JSON::Field(key: "checksum", emit_null: false)] + property checksum : String? + + validates(size, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String, @size : Int32, @creation_time : String? = nil, @checksum : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = size_validation_error(@size)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, creation_time, size, checksum) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_priority.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_priority.cr new file mode 100644 index 000000000000..cbb5e0d45db3 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_priority.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # SnapshotPriority (OpenAPI enum). Allowed values: "no_sync", "snapshot", "replica". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias SnapshotPriority = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_recover.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_recover.cr new file mode 100644 index 000000000000..c017a373bc1b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/snapshot_recover.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class SnapshotRecover + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Examples: - URL `http://localhost:8080/collections/my_collection/snapshots/my_snapshot` - Local path `file:///qdrant/snapshots/test_collection-2022-08-04-10-49-10.snapshot` + @[JSON::Field(key: "location", emit_null: false)] + property location : String + + # Optional properties + # Defines which data should be used as a source of truth if there are other replicas in the cluster. If set to `Snapshot`, the snapshot will be used as a source of truth, and the current state will be overwritten. If set to `Replica`, the current state will be used as a source of truth, and after recovery if will be synchronized with the snapshot. + @[JSON::Field(key: "priority", emit_null: false)] + property priority : SnapshotPriority? + + # Optional SHA256 checksum to verify snapshot integrity before recovery. + @[JSON::Field(key: "checksum", emit_null: false)] + property checksum : String? + + # Optional API key used when fetching the snapshot from a remote URL. + @[JSON::Field(key: "api_key", emit_null: false)] + property api_key : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@location : String, @priority : SnapshotPriority? = nil, @checksum : String? = nil, @api_key : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(location, priority, checksum, api_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_config.cr new file mode 100644 index 000000000000..6635e365fd77 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_config.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Configuration for sparse inverted index. + class SparseIndexConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "index_type", emit_null: false)] + property index_type : SparseIndexType + + # Optional properties + # We prefer a full scan search upto (excluding) this number of vectors. Note: this is number of vectors, not KiloBytes. + @[JSON::Field(key: "full_scan_threshold", emit_null: false)] + property full_scan_threshold : Int32? + + # Datatype used to store weights in the index. + @[JSON::Field(key: "datatype", emit_null: false)] + property datatype : VectorStorageDatatype? + + validates(full_scan_threshold, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@index_type : SparseIndexType, @full_scan_threshold : Int32? = nil, @datatype : VectorStorageDatatype? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = full_scan_threshold_validation_error(@full_scan_threshold)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(full_scan_threshold, index_type, datatype) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_params.cr new file mode 100644 index 000000000000..7ba2414c8146 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_params.cr @@ -0,0 +1,56 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Configuration for sparse inverted index. + class SparseIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # We prefer a full scan search upto (excluding) this number of vectors. Note: this is number of vectors, not KiloBytes. + @[JSON::Field(key: "full_scan_threshold", emit_null: false)] + property full_scan_threshold : Int32? + + # Store index on disk. If set to false, the index will be stored in RAM. Default: false + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + # Defines which datatype should be used for the index. Choosing different datatypes allows to optimize memory usage and performance vs accuracy. - For `float32` datatype - vectors are stored as single-precision floating point numbers, 4 bytes. - For `float16` datatype - vectors are stored as half-precision floating point numbers, 2 bytes. - For `uint8` datatype - vectors are quantized to unsigned 8-bit integers, 1 byte. Quantization to fit byte range `[0, 255]` happens during indexing automatically, so the actual vector data does not need to conform to this range. + @[JSON::Field(key: "datatype", emit_null: false)] + property datatype : Datatype? + + validates(full_scan_threshold, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@full_scan_threshold : Int32? = nil, @on_disk : Bool? = nil, @datatype : Datatype? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = full_scan_threshold_validation_error(@full_scan_threshold)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(full_scan_threshold, on_disk, datatype) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_type.cr new file mode 100644 index 000000000000..35c7bdea71f9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # SparseIndexType (OpenAPI enum). Allowed values: "MutableRam", "ImmutableRam", "Mmap". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias SparseIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector.cr new file mode 100644 index 000000000000..84f87571d3e9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector.cr @@ -0,0 +1,48 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Sparse vector structure + class SparseVector + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Indices must be unique + @[JSON::Field(key: "indices", emit_null: false)] + property indices : Array(Int32) + + # Values and indices must be the same length + @[JSON::Field(key: "values", emit_null: false)] + property values : Array(Float32) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@indices : Array(Int32), @values : Array(Float32)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(indices, values) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector_data_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector_data_config.cr new file mode 100644 index 000000000000..48b3df9cb4df --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector_data_config.cr @@ -0,0 +1,43 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Config of single sparse vector data storage + class SparseVectorDataConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "index", emit_null: false)] + property index : SparseIndexConfig + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@index : SparseIndexConfig) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(index) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector_params.cr new file mode 100644 index 000000000000..e684b6b9dddf --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/sparse_vector_params.cr @@ -0,0 +1,48 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Params of single sparse vector data storage + class SparseVectorParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Custom params for index. If none - values from collection configuration are used. + @[JSON::Field(key: "index", emit_null: false)] + property index : SparseIndexParams? + + # Configures addition value modifications for sparse vectors. Default: none + @[JSON::Field(key: "modifier", emit_null: false)] + property modifier : Modifier? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@index : SparseIndexParams? = nil, @modifier : Modifier? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(index, modifier) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/start_from.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/start_from.cr new file mode 100644 index 000000000000..180502c39458 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/start_from.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # StartFrom (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class StartFrom + getter value + + def initialize(@value : Float64) + end + def initialize(@value : Int64) + end + def initialize(@value : Time) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Float64, Int64, Time + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Float64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Time.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in StartFrom (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Float64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Time.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in StartFrom (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/state_role.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/state_role.cr new file mode 100644 index 000000000000..7759350391c9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/state_role.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # StateRole (OpenAPI enum). Allowed values: "Follower", "Candidate", "Leader", "PreCandidate". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias StateRole = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/telemetry200_response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/telemetry200_response.cr new file mode 100644 index 000000000000..b309c968f507 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/telemetry200_response.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class Telemetry200Response + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Time spent to process this request + @[JSON::Field(key: "time", emit_null: false)] + property time : Float32? + + @[JSON::Field(key: "status", emit_null: false)] + property status : String? + + @[JSON::Field(key: "result", emit_null: false)] + property result : TelemetryData? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@time : Float32? = nil, @status : String? = nil, @result : TelemetryData? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(time, status, result) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/telemetry_data.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/telemetry_data.cr new file mode 100644 index 000000000000..f3e55694dd67 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/telemetry_data.cr @@ -0,0 +1,54 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class TelemetryData + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "id", emit_null: false)] + property id : String + + @[JSON::Field(key: "app", emit_null: false)] + property app : AppBuildTelemetry + + @[JSON::Field(key: "collections", emit_null: false)] + property collections : CollectionsTelemetry + + @[JSON::Field(key: "cluster", emit_null: false)] + property cluster : ClusterTelemetry + + @[JSON::Field(key: "requests", emit_null: false)] + property requests : RequestsTelemetry + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@id : String, @app : AppBuildTelemetry, @collections : CollectionsTelemetry, @cluster : ClusterTelemetry, @requests : RequestsTelemetry) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(id, app, collections, cluster, requests) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/text_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/text_index_params.cr new file mode 100644 index 000000000000..aee46d62186e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/text_index_params.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class TextIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : TextIndexType + + # Optional properties + @[JSON::Field(key: "tokenizer", emit_null: false)] + property tokenizer : TokenizerType? + + # Minimum characters to be tokenized. + @[JSON::Field(key: "min_token_len", emit_null: false)] + property min_token_len : Int32? + + # Maximum characters to be tokenized. + @[JSON::Field(key: "max_token_len", emit_null: false)] + property max_token_len : Int32? + + # If true, lowercase all tokens. Default: true. + @[JSON::Field(key: "lowercase", emit_null: false)] + property lowercase : Bool? + + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + validates(min_token_len, Int32, true, minimum: 0) + validates(max_token_len, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : TextIndexType, @tokenizer : TokenizerType? = nil, @min_token_len : Int32? = nil, @max_token_len : Int32? = nil, @lowercase : Bool? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = min_token_len_validation_error(@min_token_len)) + invalid_properties.push(msg) + end + if (msg = max_token_len_validation_error(@max_token_len)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, tokenizer, min_token_len, max_token_len, lowercase, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/text_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/text_index_type.cr new file mode 100644 index 000000000000..c97de2a20a0c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/text_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # TextIndexType (OpenAPI enum). Allowed values: "text". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias TextIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/tokenizer_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tokenizer_type.cr new file mode 100644 index 000000000000..a31361479db7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tokenizer_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # TokenizerType (OpenAPI enum). Allowed values: "prefix", "whitespace", "word", "multilingual". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias TokenizerType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_status.cr new file mode 100644 index 000000000000..2604b8883f3b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_status.cr @@ -0,0 +1,90 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Represents the current state of the optimizer being tracked + # TrackerStatus (OpenAPI oneOf): a value matching exactly one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order (the first + # that parses wins), so it transparently handles scalar, array and object members. It does NOT + # include JSON/YAML::Serializable (which would generate a field-based constructor that can't + # build a union); it defines its own (de)serialisation hooks instead. + class TrackerStatus + getter value + + def initialize(@value : OptimizersStatusOneOf) + end + def initialize(@value : String) + end + def initialize(@value : TrackerStatusOneOf) + end + + # List of classes defined in oneOf (OpenAPI v3) + def self.openapi_one_of + [ + OptimizersStatusOneOf, String, TrackerStatusOneOf + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(OptimizersStatusOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(TrackerStatusOneOf.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in TrackerStatus (oneOf)", 0, 0) + end + + # Backwards-compatible builder: returns a wrapped instance or nil if nothing matched. + def self.build(data) : self? + from_json_any(data.is_a?(JSON::Any) ? data : JSON.parse(data.to_json)) + rescue JSON::ParseException + nil + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(OptimizersStatusOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(TrackerStatusOneOf.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in TrackerStatus (oneOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_status_one_of.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_status_one_of.cr new file mode 100644 index 000000000000..74532ca3e6e6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_status_one_of.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class TrackerStatusOneOf + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "cancelled", emit_null: false)] + property cancelled : String + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@cancelled : String) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(cancelled) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_telemetry.cr new file mode 100644 index 000000000000..906d674a4d23 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/tracker_telemetry.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Tracker object used in telemetry + class TrackerTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Name of the optimizer + @[JSON::Field(key: "name", emit_null: false)] + property name : String + + # Segment IDs being optimized + @[JSON::Field(key: "segment_ids", emit_null: false)] + property segment_ids : Array(Int32) + + @[JSON::Field(key: "status", emit_null: false)] + property status : TrackerStatus + + # Start time of the optimizer + @[JSON::Field(key: "start_at", emit_null: false)] + property start_at : Time + + # Optional properties + # End time of the optimizer + @[JSON::Field(key: "end_at", emit_null: false)] + property end_at : Time? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String, @segment_ids : Array(Int32), @status : TrackerStatus, @start_at : Time, @end_at : Time? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, segment_ids, status, start_at, end_at) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_collection.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_collection.cr new file mode 100644 index 000000000000..1d4c5edb4208 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_collection.cr @@ -0,0 +1,64 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Operation for updating parameters of the existing collection + class UpdateCollection + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Map of vector data parameters to update for each named vector. To update parameters in a collection having a single unnamed vector, use an empty string as name. + @[JSON::Field(key: "vectors", emit_null: false)] + property vectors : Hash(String, VectorParamsDiff)? + + # Custom params for Optimizers. If none - it is left unchanged. This operation is blocking, it will only proceed once all current optimizations are complete + @[JSON::Field(key: "optimizers_config", emit_null: false)] + property optimizers_config : OptimizersConfigDiff? + + # Collection base params. If none - it is left unchanged. + @[JSON::Field(key: "params", emit_null: false)] + property params : CollectionParamsDiff? + + # HNSW parameters to update for the collection index. If none - it is left unchanged. + @[JSON::Field(key: "hnsw_config", emit_null: false)] + property hnsw_config : HnswConfigDiff? + + # Quantization parameters to update. If none - it is left unchanged. + @[JSON::Field(key: "quantization_config", emit_null: false)] + property quantization_config : QuantizationConfigDiff? + + # Map of sparse vector data parameters to update for each sparse vector. + @[JSON::Field(key: "sparse_vectors", emit_null: false)] + property sparse_vectors : Hash(String, SparseVectorParams)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@vectors : Hash(String, VectorParamsDiff)? = nil, @optimizers_config : OptimizersConfigDiff? = nil, @params : CollectionParamsDiff? = nil, @hnsw_config : HnswConfigDiff? = nil, @quantization_config : QuantizationConfigDiff? = nil, @sparse_vectors : Hash(String, SparseVectorParams)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(vectors, optimizers_config, params, hnsw_config, quantization_config, sparse_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_operation.cr new file mode 100644 index 000000000000..f7b985a98707 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_operation.cr @@ -0,0 +1,130 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # UpdateOperation (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class UpdateOperation + getter value + + def initialize(@value : ClearPayloadOperation) + end + def initialize(@value : DeleteOperation) + end + def initialize(@value : DeletePayloadOperation) + end + def initialize(@value : DeleteVectorsOperation) + end + def initialize(@value : OverwritePayloadOperation) + end + def initialize(@value : SetPayloadOperation) + end + def initialize(@value : UpdateVectorsOperation) + end + def initialize(@value : UpsertOperation) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + ClearPayloadOperation, DeleteOperation, DeletePayloadOperation, DeleteVectorsOperation, OverwritePayloadOperation, SetPayloadOperation, UpdateVectorsOperation, UpsertOperation + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(ClearPayloadOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeleteOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeletePayloadOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeleteVectorsOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(OverwritePayloadOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(SetPayloadOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(UpdateVectorsOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(UpsertOperation.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in UpdateOperation (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(ClearPayloadOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeleteOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeletePayloadOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(DeleteVectorsOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(OverwritePayloadOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(SetPayloadOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(UpdateVectorsOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(UpsertOperation.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in UpdateOperation (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_operations.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_operations.cr new file mode 100644 index 000000000000..7509bab83ca9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_operations.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class UpdateOperations + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "operations", emit_null: false)] + property operations : Array(UpdateOperation) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@operations : Array(UpdateOperation)) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(operations) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_result.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_result.cr new file mode 100644 index 000000000000..46c58781e44a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_result.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class UpdateResult + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "status", emit_null: false)] + property status : UpdateStatus + + # Optional properties + # Sequential number of the operation + @[JSON::Field(key: "operation_id", emit_null: false)] + property operation_id : Int32? + + validates(operation_id, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@status : UpdateStatus, @operation_id : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = operation_id_validation_error(@operation_id)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(operation_id, status) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_status.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_status.cr new file mode 100644 index 000000000000..e0fece6e4ae7 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_status.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # UpdateStatus (OpenAPI enum). Allowed values: "acknowledged", "completed". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias UpdateStatus = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_vectors.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_vectors.cr new file mode 100644 index 000000000000..cfda1eccb7f0 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_vectors.cr @@ -0,0 +1,47 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class UpdateVectors + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Points with named vectors + @[JSON::Field(key: "points", emit_null: false)] + property points : Array(PointVectors) + + # Optional properties + @[JSON::Field(key: "shard_key", emit_null: false)] + property shard_key : ShardKeySelector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@points : Array(PointVectors), @shard_key : ShardKeySelector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(points, shard_key) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_vectors_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_vectors_operation.cr new file mode 100644 index 000000000000..505719a0f9e9 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/update_vectors_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class UpdateVectorsOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "update_vectors", emit_null: false)] + property update_vectors : UpdateVectors + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@update_vectors : UpdateVectors) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(update_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/upsert_operation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/upsert_operation.cr new file mode 100644 index 000000000000..4945d2690670 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/upsert_operation.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class UpsertOperation + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "upsert", emit_null: false)] + property upsert : PointInsertOperations + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@upsert : PointInsertOperations) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(upsert) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/uuid_index_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/uuid_index_params.cr new file mode 100644 index 000000000000..501f122e7236 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/uuid_index_params.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class UuidIndexParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : UuidIndexType + + # Optional properties + # If true - used for tenant optimization. + @[JSON::Field(key: "is_tenant", emit_null: false)] + property is_tenant : Bool? + + # If true, store the index on disk. Default: false. + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : UuidIndexType, @is_tenant : Bool? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, is_tenant, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/uuid_index_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/uuid_index_type.cr new file mode 100644 index 000000000000..aa0a15a634ce --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/uuid_index_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # UuidIndexType (OpenAPI enum). Allowed values: "uuid". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias UuidIndexType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/value_variants.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/value_variants.cr new file mode 100644 index 000000000000..f63ed4086d61 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/value_variants.cr @@ -0,0 +1,80 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # ValueVariants (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class ValueVariants + getter value + + def initialize(@value : Bool) + end + def initialize(@value : Int64) + end + def initialize(@value : String) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Bool, Int64, String + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Bool.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in ValueVariants (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Bool.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Int64.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in ValueVariants (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/values_count.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/values_count.cr new file mode 100644 index 000000000000..09cea923466d --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/values_count.cr @@ -0,0 +1,72 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Values count filter request + class ValuesCount + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # point.key.length() < values_count.lt + @[JSON::Field(key: "lt", emit_null: false)] + property lt : Int32? + + # point.key.length() > values_count.gt + @[JSON::Field(key: "gt", emit_null: false)] + property gt : Int32? + + # point.key.length() >= values_count.gte + @[JSON::Field(key: "gte", emit_null: false)] + property gte : Int32? + + # point.key.length() <= values_count.lte + @[JSON::Field(key: "lte", emit_null: false)] + property lte : Int32? + + validates(lt, Int32, true, minimum: 0) + validates(gt, Int32, true, minimum: 0) + validates(gte, Int32, true, minimum: 0) + validates(lte, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@lt : Int32? = nil, @gt : Int32? = nil, @gte : Int32? = nil, @lte : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = lt_validation_error(@lt)) + invalid_properties.push(msg) + end + if (msg = gt_validation_error(@gt)) + invalid_properties.push(msg) + end + if (msg = gte_validation_error(@gte)) + invalid_properties.push(msg) + end + if (msg = lte_validation_error(@lte)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(lt, gt, gte, lte) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector.cr new file mode 100644 index 000000000000..cc1b17a1b886 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector.cr @@ -0,0 +1,90 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Vector (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class Vector + getter value + + def initialize(@value : Array(Array(Float32))) + end + def initialize(@value : Array(Float32)) + end + def initialize(@value : Document) + end + def initialize(@value : SparseVector) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Array(Float32)), Array(Float32), Document, SparseVector + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Array(Float32)).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Float32).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Document.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(SparseVector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in Vector (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Array(Float32)).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Float32).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Document.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(SparseVector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in Vector (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_data_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_data_config.cr new file mode 100644 index 000000000000..ec747528359a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_data_config.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Config of single vector data storage + class VectorDataConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Size/dimensionality of the vectors used + @[JSON::Field(key: "size", emit_null: false)] + property size : Int32 + + @[JSON::Field(key: "distance", emit_null: false)] + property distance : Distance + + @[JSON::Field(key: "storage_type", emit_null: false)] + property storage_type : VectorStorageType + + @[JSON::Field(key: "index", emit_null: false)] + property index : Indexes + + # Optional properties + # Vector specific quantization config that overrides collection config + @[JSON::Field(key: "quantization_config", emit_null: false)] + property quantization_config : QuantizationConfig? + + # Vector specific configuration to enable multiple vectors per point + @[JSON::Field(key: "multivector_config", emit_null: false)] + property multivector_config : MultiVectorConfig? + + # Vector specific configuration to set specific storage element type + @[JSON::Field(key: "datatype", emit_null: false)] + property datatype : VectorStorageDatatype? + + validates(size, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@size : Int32, @distance : Distance, @storage_type : VectorStorageType, @index : Indexes, @quantization_config : QuantizationConfig? = nil, @multivector_config : MultiVectorConfig? = nil, @datatype : VectorStorageDatatype? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = size_validation_error(@size)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(size, distance, storage_type, index, quantization_config, multivector_config, datatype) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_data_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_data_info.cr new file mode 100644 index 000000000000..429ef1b9d902 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_data_info.cr @@ -0,0 +1,60 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class VectorDataInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "num_vectors", emit_null: false)] + property num_vectors : Int32 + + @[JSON::Field(key: "num_indexed_vectors", emit_null: false)] + property num_indexed_vectors : Int32 + + @[JSON::Field(key: "num_deleted_vectors", emit_null: false)] + property num_deleted_vectors : Int32 + + validates(num_vectors, Int32, false, minimum: 0) + validates(num_indexed_vectors, Int32, false, minimum: 0) + validates(num_deleted_vectors, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@num_vectors : Int32, @num_indexed_vectors : Int32, @num_deleted_vectors : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = num_vectors_validation_error(@num_vectors)) + invalid_properties.push(msg) + end + if (msg = num_indexed_vectors_validation_error(@num_indexed_vectors)) + invalid_properties.push(msg) + end + if (msg = num_deleted_vectors_validation_error(@num_deleted_vectors)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(num_vectors, num_indexed_vectors, num_deleted_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_index_searches_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_index_searches_telemetry.cr new file mode 100644 index 000000000000..5f4a1b72fb84 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_index_searches_telemetry.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class VectorIndexSearchesTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "unfiltered_plain", emit_null: false)] + property unfiltered_plain : OperationDurationStatistics + + @[JSON::Field(key: "unfiltered_hnsw", emit_null: false)] + property unfiltered_hnsw : OperationDurationStatistics + + @[JSON::Field(key: "unfiltered_sparse", emit_null: false)] + property unfiltered_sparse : OperationDurationStatistics + + @[JSON::Field(key: "filtered_plain", emit_null: false)] + property filtered_plain : OperationDurationStatistics + + @[JSON::Field(key: "filtered_small_cardinality", emit_null: false)] + property filtered_small_cardinality : OperationDurationStatistics + + @[JSON::Field(key: "filtered_large_cardinality", emit_null: false)] + property filtered_large_cardinality : OperationDurationStatistics + + @[JSON::Field(key: "filtered_exact", emit_null: false)] + property filtered_exact : OperationDurationStatistics + + @[JSON::Field(key: "filtered_sparse", emit_null: false)] + property filtered_sparse : OperationDurationStatistics + + @[JSON::Field(key: "unfiltered_exact", emit_null: false)] + property unfiltered_exact : OperationDurationStatistics + + # Optional properties + @[JSON::Field(key: "index_name", emit_null: false)] + property index_name : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@unfiltered_plain : OperationDurationStatistics, @unfiltered_hnsw : OperationDurationStatistics, @unfiltered_sparse : OperationDurationStatistics, @filtered_plain : OperationDurationStatistics, @filtered_small_cardinality : OperationDurationStatistics, @filtered_large_cardinality : OperationDurationStatistics, @filtered_exact : OperationDurationStatistics, @filtered_sparse : OperationDurationStatistics, @unfiltered_exact : OperationDurationStatistics, @index_name : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(index_name, unfiltered_plain, unfiltered_hnsw, unfiltered_sparse, filtered_plain, filtered_small_cardinality, filtered_large_cardinality, filtered_exact, filtered_sparse, unfiltered_exact) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_input.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_input.cr new file mode 100644 index 000000000000..06239db1dee4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_input.cr @@ -0,0 +1,100 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # VectorInput (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class VectorInput + getter value + + def initialize(@value : Array(Array(Float32))) + end + def initialize(@value : Array(Float32)) + end + def initialize(@value : Document) + end + def initialize(@value : ExtendedPointId) + end + def initialize(@value : SparseVector) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Array(Float32)), Array(Float32), Document, ExtendedPointId, SparseVector + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Array(Float32)).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Float32).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Document.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(ExtendedPointId.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(SparseVector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in VectorInput (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Array(Float32)).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Float32).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Document.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(ExtendedPointId.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(SparseVector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in VectorInput (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_params.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_params.cr new file mode 100644 index 000000000000..4758e153639b --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_params.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Params of single vector data storage + class VectorParams + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Size of a vectors used + @[JSON::Field(key: "size", emit_null: false)] + property size : Int32 + + @[JSON::Field(key: "distance", emit_null: false)] + property distance : Distance + + # Optional properties + # Custom params for HNSW index. If none - values from collection configuration are used. + @[JSON::Field(key: "hnsw_config", emit_null: false)] + property hnsw_config : HnswConfigDiff? + + # Custom params for quantization. If none - values from collection configuration are used. + @[JSON::Field(key: "quantization_config", emit_null: false)] + property quantization_config : QuantizationConfig? + + # If true, vectors are served from disk, improving RAM usage at the cost of latency Default: false + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + # Defines which datatype should be used to represent vectors in the storage. Choosing different datatypes allows to optimize memory usage and performance vs accuracy. - For `float32` datatype - vectors are stored as single-precision floating point numbers, 4 bytes. - For `float16` datatype - vectors are stored as half-precision floating point numbers, 2 bytes. - For `uint8` datatype - vectors are stored as unsigned 8-bit integers, 1 byte. It expects vector elements to be in range `[0, 255]`. + @[JSON::Field(key: "datatype", emit_null: false)] + property datatype : Datatype? + + @[JSON::Field(key: "multivector_config", emit_null: false)] + property multivector_config : MultiVectorConfig? + + validates(size, Int32, false, minimum: 1) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@size : Int32, @distance : Distance, @hnsw_config : HnswConfigDiff? = nil, @quantization_config : QuantizationConfig? = nil, @on_disk : Bool? = nil, @datatype : Datatype? = nil, @multivector_config : MultiVectorConfig? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = size_validation_error(@size)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(size, distance, hnsw_config, quantization_config, on_disk, datatype, multivector_config) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_params_diff.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_params_diff.cr new file mode 100644 index 000000000000..f5d29eb333d5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_params_diff.cr @@ -0,0 +1,51 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class VectorParamsDiff + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Update params for HNSW index. If empty object - it will be unset. + @[JSON::Field(key: "hnsw_config", emit_null: false)] + property hnsw_config : HnswConfigDiff? + + # Update params for quantization. If none - it is left unchanged. + @[JSON::Field(key: "quantization_config", emit_null: false)] + property quantization_config : QuantizationConfigDiff? + + # If true, vectors are served from disk, improving RAM usage at the cost of latency + @[JSON::Field(key: "on_disk", emit_null: false)] + property on_disk : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@hnsw_config : HnswConfigDiff? = nil, @quantization_config : QuantizationConfigDiff? = nil, @on_disk : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(hnsw_config, quantization_config, on_disk) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_storage_datatype.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_storage_datatype.cr new file mode 100644 index 000000000000..b5afa1d3a52f --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_storage_datatype.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # VectorStorageDatatype (OpenAPI enum). Allowed values: "float32", "float16", "uint8". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias VectorStorageDatatype = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_storage_type.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_storage_type.cr new file mode 100644 index 000000000000..9550dee65b64 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_storage_type.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # VectorStorageType (OpenAPI enum). Allowed values: "Memory", "Mmap", "ChunkedMmap", "InRamChunkedMmap". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias VectorStorageType = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_struct.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_struct.cr new file mode 100644 index 000000000000..8620c4c6fec8 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vector_struct.cr @@ -0,0 +1,91 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Full vector data per point separator with single and multiple vector modes + # VectorStruct (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class VectorStruct + getter value + + def initialize(@value : Array(Array(Float32))) + end + def initialize(@value : Array(Float32)) + end + def initialize(@value : Document) + end + def initialize(@value : Hash(String, Vector)) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(Array(Float32)), Array(Float32), Document, Hash(String, Vector) + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(Array(Float32)).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Float32).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Document.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Hash(String, Vector).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in VectorStruct (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(Array(Float32)).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Array(Float32).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Document.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Hash(String, Vector).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in VectorStruct (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/vectors_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vectors_config.cr new file mode 100644 index 000000000000..fb20de641d21 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/vectors_config.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Vector params separator for single and multiple vector modes Single mode: { \"size\": 128, \"distance\": \"Cosine\" } or multiple mode: { \"default\": { \"size\": 128, \"distance\": \"Cosine\" } } + # VectorsConfig (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class VectorsConfig + getter value + + def initialize(@value : Hash(String, VectorParams)) + end + def initialize(@value : VectorParams) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Hash(String, VectorParams), VectorParams + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Hash(String, VectorParams).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(VectorParams.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in VectorsConfig (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Hash(String, VectorParams).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(VectorParams.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in VectorsConfig (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/version_info.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/version_info.cr new file mode 100644 index 000000000000..de99142c02a4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/version_info.cr @@ -0,0 +1,49 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class VersionInfo + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "title", emit_null: false)] + property title : String + + @[JSON::Field(key: "version", emit_null: false)] + property version : String + + # Optional properties + @[JSON::Field(key: "commit", emit_null: false)] + property commit : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@title : String, @version : String, @commit : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(title, version, commit) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/wal_config.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/wal_config.cr new file mode 100644 index 000000000000..f83550be398c --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/wal_config.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class WalConfig + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Size of a single WAL segment in MB + @[JSON::Field(key: "wal_capacity_mb", emit_null: false)] + property wal_capacity_mb : Int32 + + # Number of WAL segments to create ahead of actually used ones + @[JSON::Field(key: "wal_segments_ahead", emit_null: false)] + property wal_segments_ahead : Int32 + + validates(wal_capacity_mb, Int32, false, minimum: 1) + validates(wal_segments_ahead, Int32, false, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@wal_capacity_mb : Int32, @wal_segments_ahead : Int32) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = wal_capacity_mb_validation_error(@wal_capacity_mb)) + invalid_properties.push(msg) + end + if (msg = wal_segments_ahead_validation_error(@wal_segments_ahead)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(wal_capacity_mb, wal_segments_ahead) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/wal_config_diff.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/wal_config_diff.cr new file mode 100644 index 000000000000..8cd6c55581e5 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/wal_config_diff.cr @@ -0,0 +1,55 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class WalConfigDiff + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Optional properties + # Size of a single WAL segment in MB + @[JSON::Field(key: "wal_capacity_mb", emit_null: false)] + property wal_capacity_mb : Int32? + + # Number of WAL segments to create ahead of actually used ones + @[JSON::Field(key: "wal_segments_ahead", emit_null: false)] + property wal_segments_ahead : Int32? + + validates(wal_capacity_mb, Int32, true, minimum: 1) + validates(wal_segments_ahead, Int32, true, minimum: 0) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@wal_capacity_mb : Int32? = nil, @wal_segments_ahead : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = wal_capacity_mb_validation_error(@wal_capacity_mb)) + invalid_properties.push(msg) + end + if (msg = wal_segments_ahead_validation_error(@wal_segments_ahead)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(wal_capacity_mb, wal_segments_ahead) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/web_api_telemetry.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/web_api_telemetry.cr new file mode 100644 index 000000000000..366dbd38541a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/web_api_telemetry.cr @@ -0,0 +1,42 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class WebApiTelemetry + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + @[JSON::Field(key: "responses", emit_null: false)] + property responses : Hash(String, Hash(String, OperationDurationStatistics)) + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@responses : Hash(String, Hash(String, OperationDurationStatistics))) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(responses) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_lookup.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_lookup.cr new file mode 100644 index 000000000000..fe1128fc7675 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_lookup.cr @@ -0,0 +1,52 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + class WithLookup + include JSON::Serializable + include YAML::Serializable + include Qdrant::Api::Serializable + include Qdrant::Api::Validation + + # Required properties + # Name of the collection to use for points lookup + @[JSON::Field(key: "collection", emit_null: false)] + property collection : String + + # Optional properties + # Options for specifying which payload to include (or not) + @[JSON::Field(key: "with_payload", emit_null: false)] + property with_payload : WithPayloadInterface? + + # Options for specifying which vectors to include (or not) + @[JSON::Field(key: "with_vectors", emit_null: false)] + property with_vectors : WithVector? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@collection : String, @with_payload : WithPayloadInterface? = nil, @with_vectors : WithVector? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(collection, with_payload, with_vectors) + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_lookup_interface.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_lookup_interface.cr new file mode 100644 index 000000000000..830570d52a7a --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_lookup_interface.cr @@ -0,0 +1,70 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # WithLookupInterface (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class WithLookupInterface + getter value + + def initialize(@value : String) + end + def initialize(@value : WithLookup) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + String, WithLookup + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(String.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(WithLookup.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in WithLookupInterface (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(String.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(WithLookup.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in WithLookupInterface (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_payload_interface.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_payload_interface.cr new file mode 100644 index 000000000000..3eb6e870ffee --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_payload_interface.cr @@ -0,0 +1,81 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Options for specifying which payload to include or not + # WithPayloadInterface (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class WithPayloadInterface + getter value + + def initialize(@value : Array(String)) + end + def initialize(@value : Bool) + end + def initialize(@value : PayloadSelector) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(String), Bool, PayloadSelector + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(String).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Bool.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadSelector.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in WithPayloadInterface (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(String).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Bool.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(PayloadSelector.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in WithPayloadInterface (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_vector.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_vector.cr new file mode 100644 index 000000000000..3c6cfa6aecf4 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/with_vector.cr @@ -0,0 +1,71 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # Options for specifying which vector to include + # WithVector (OpenAPI anyOf): a value matching at least one of the listed schemas. + # Implemented as a thin wrapper that (de)serialises by trying each member in order + # (the first that parses wins), so it transparently handles scalar, array and object members. + class WithVector + getter value + + def initialize(@value : Array(String)) + end + def initialize(@value : Bool) + end + + # List of classes defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + Array(String), Bool + ] + end + + def self.from_json(string_or_io) : self + from_json_any(JSON.parse(string_or_io)) + end + + def self.new(pull : JSON::PullParser) + from_json_any(JSON::Any.new(pull)) + end + + def self.from_json_any(data : JSON::Any) : self + json = data.to_json + begin + return new(Array(String).from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + begin + return new(Bool.from_json(json)) + rescue JSON::ParseException | ArgumentError | TypeCastError + end + raise JSON::ParseException.new("`#{json}` doesn't match any schema listed in WithVector (anyOf)", 0, 0) + end + + def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) + begin + return new(Array(String).new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + begin + return new(Bool.new(ctx, node)) + rescue YAML::ParseException | ArgumentError | TypeCastError + end + raise YAML::ParseException.new("doesn't match any schema listed in WithVector (anyOf)", 0, 0) + end + + def to_json(builder : JSON::Builder) + @value.to_json(builder) + end + + def to_yaml(builder : YAML::Nodes::Builder) + @value.to_yaml(builder) + end + end + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/models/write_ordering.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/models/write_ordering.cr new file mode 100644 index 000000000000..2be832a9dcce --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/models/write_ordering.cr @@ -0,0 +1,15 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Qdrant::Api + # WriteOrdering (OpenAPI enum). Allowed values: "weak", "medium", "strong". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias WriteOrdering = String + +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/response.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/response.cr new file mode 100644 index 000000000000..16cfb0d24381 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/response.cr @@ -0,0 +1,13 @@ +module Qdrant::Api + struct Response(T) + getter value : T + getter status : Int32 + getter headers : HTTP::Headers + + def initialize(@value : T, @status : Int32, @headers : HTTP::Headers); end + + def success? : Bool + 200 <= @status < 300 + end + end +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/serializable.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/serializable.cr new file mode 100644 index 000000000000..dec6bcc397e6 --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/serializable.cr @@ -0,0 +1,33 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# +require "json" + +module Qdrant::Api + # Shared serialization helpers mixed into every generated model. + module Serializable + # Returns the string representation of the object + def to_s(io : IO) : Nil + io << to_json + end + + # to_body is an alias to to_h (backward compatibility) + def to_body : Hash(String, JSON::Any) + to_h + end + + # Returns the object in the form of hash + def to_h : Hash(String, JSON::Any) + JSON.parse(to_json).as_h + end + + # @see the `==` method + def eql?(other) + self == other + end + end +end diff --git a/samples/client/others/crystal-qdrant/src/qdrant-api/validation.cr b/samples/client/others/crystal-qdrant/src/qdrant-api/validation.cr new file mode 100644 index 000000000000..a52c43827a5e --- /dev/null +++ b/samples/client/others/crystal-qdrant/src/qdrant-api/validation.cr @@ -0,0 +1,37 @@ +# #Qdrant API +# +#The version of the OpenAPI document: master +#Contact: andrey@vasnetsov.com +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# +module Qdrant::Api + # Shared macro for declarative property validation. Include it in a model and + # declare `validates(name, Type, nilable, **rules)` per validated property. + # Supported rule keys: enum, max_length, min_length, maximum, exclusive_maximum, + # minimum, exclusive_minimum, pattern, max_items, min_items. + module Validation + macro validates(name, klass, nilable, **rules) + {% if rules[:enum] %}{{name.id.upcase}}_ALLOWED = {{rules[:enum]}}{% end %} + + def {{name.id}}=(value : {{klass}}{% if nilable %}?{% end %}) + if (msg = {{name.id}}_validation_error(value)) + raise ArgumentError.new(msg) + end + @{{name.id}} = value + end + + def {{name.id}}_validation_error(value) : String? + {% if rules[:enum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be one of #{ {{name.id.upcase}}_ALLOWED }" unless value.nil? || {{name.id.upcase}}_ALLOWED.includes?(value) + {% end %}{% if rules[:max_length] %}return "invalid value for \"#{ {{name.stringify}} }\", the character length must be smaller than or equal to {{rules[:max_length]}}." if value.try &.to_s.try &.size.try &.> {{rules[:max_length]}} + {% end %}{% if rules[:min_length] %}return "invalid value for \"#{ {{name.stringify}} }\", the character length must be greater than or equal to {{rules[:min_length]}}." if value.try &.to_s.try &.size.try &.< {{rules[:min_length]}} + {% end %}{% if rules[:maximum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be smaller than{% if rules[:exclusive_maximum] %}{% else %} or equal to{% end %} {{rules[:maximum]}}." if value.try &.>{% if rules[:exclusive_maximum] %}={% end %} {{rules[:maximum]}} + {% end %}{% if rules[:minimum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be greater than{% if rules[:exclusive_minimum] %}{% else %} or equal to{% end %} {{rules[:minimum]}}." if value.try &.<{% if rules[:exclusive_minimum] %}={% end %} {{rules[:minimum]}} + {% end %}{% if rules[:pattern] %}return "invalid value for \"#{ {{name.stringify}} }\", must conform to the pattern {{rules[:pattern]}}." if value.try &.!~ {{rules[:pattern]}} + {% end %}{% if rules[:max_items] %}return "invalid value for \"#{ {{name.stringify}} }\", number of items must be less than or equal to {{rules[:max_items]}}." if value.try &.size.try &.> {{rules[:max_items]}} + {% end %}{% if rules[:min_items] %}return "invalid value for \"#{ {{name.stringify}} }\", number of items must be greater than or equal to {{rules[:min_items]}}." if value.try &.size.try &.< {{rules[:min_items]}} + {% end %}nil + end + end + end +end diff --git a/samples/client/petstore/crystal/.gitignore b/samples/client/petstore/crystal/.gitignore index 1a7e69fd1cdb..15f3b69381a3 100644 --- a/samples/client/petstore/crystal/.gitignore +++ b/samples/client/petstore/crystal/.gitignore @@ -12,3 +12,6 @@ /shard.lock /tmp/ + +# Spectator run artifact +.spectator-failures diff --git a/samples/client/petstore/crystal/.openapi-generator-ignore b/samples/client/petstore/crystal/.openapi-generator-ignore index 82e4e79984b4..6b5697cce839 100644 --- a/samples/client/petstore/crystal/.openapi-generator-ignore +++ b/samples/client/petstore/crystal/.openapi-generator-ignore @@ -21,5 +21,7 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md -# -# + +# Hand-maintained live-server integration specs (the generated spec/api/* +# stubs are structural-only and must not hit the network). +spec/integration/** diff --git a/samples/client/petstore/crystal/.openapi-generator/FILES b/samples/client/petstore/crystal/.openapi-generator/FILES index 27f0b76ec782..2fba3109b505 100644 --- a/samples/client/petstore/crystal/.openapi-generator/FILES +++ b/samples/client/petstore/crystal/.openapi-generator/FILES @@ -4,19 +4,68 @@ git_push.sh shard.yml spec/spec_helper.cr src/petstore.cr -src/petstore/api/fake_api.cr -src/petstore/api/pet_api.cr -src/petstore/api/store_api.cr -src/petstore/api/user_api.cr -src/petstore/api_client.cr +src/petstore/api/another_fake.cr +src/petstore/api/fake.cr +src/petstore/api/fake_classname_test.cr +src/petstore/api/foo.cr +src/petstore/api/pet.cr +src/petstore/api/store.cr +src/petstore/api/store/order.cr +src/petstore/api/user.cr src/petstore/api_error.cr +src/petstore/client.cr src/petstore/configuration.cr -src/petstore/models/another_property_name_mapping.cr +src/petstore/connection.cr +src/petstore/models/additional_properties_class.cr +src/petstore/models/all_of_with_single_ref.cr +src/petstore/models/animal.cr src/petstore/models/api_response.cr +src/petstore/models/array_of_array_of_number_only.cr +src/petstore/models/array_of_number_only.cr +src/petstore/models/array_test.cr +src/petstore/models/capitalization.cr +src/petstore/models/cat.cr src/petstore/models/category.cr +src/petstore/models/child_with_nullable.cr +src/petstore/models/class_model.cr +src/petstore/models/deprecated_object.cr +src/petstore/models/dog.cr +src/petstore/models/enum_arrays.cr +src/petstore/models/enum_class.cr +src/petstore/models/enum_test.cr +src/petstore/models/fake_big_decimal_map200_response.cr +src/petstore/models/file.cr +src/petstore/models/file_schema_test_class.cr +src/petstore/models/foo.cr +src/petstore/models/foo_get_default_response.cr src/petstore/models/format_test.cr +src/petstore/models/has_only_read_only.cr +src/petstore/models/health_check_result.cr +src/petstore/models/list.cr +src/petstore/models/map_test.cr +src/petstore/models/mixed_properties_and_additional_properties_class.cr +src/petstore/models/model200_response.cr +src/petstore/models/model_client.cr +src/petstore/models/model_return.cr +src/petstore/models/name.cr +src/petstore/models/nullable_class.cr +src/petstore/models/number_only.cr +src/petstore/models/object_with_deprecated_fields.cr src/petstore/models/order.cr +src/petstore/models/outer_composite.cr +src/petstore/models/outer_enum.cr +src/petstore/models/outer_enum_default_value.cr +src/petstore/models/outer_enum_integer.cr +src/petstore/models/outer_enum_integer_default_value.cr +src/petstore/models/outer_object_with_enum_property.cr +src/petstore/models/parent_with_nullable.cr src/petstore/models/pet.cr +src/petstore/models/read_only_first.cr +src/petstore/models/single_ref_type.cr +src/petstore/models/special_model_name.cr src/petstore/models/tag.cr +src/petstore/models/test_inline_freeform_additional_properties_request.cr src/petstore/models/user.cr -src/petstore/recursive_hash.cr +src/petstore/response.cr +src/petstore/serializable.cr +src/petstore/validation.cr diff --git a/samples/client/petstore/crystal/.travis.yml b/samples/client/petstore/crystal/.travis.yml deleted file mode 100644 index 2072dbebc539..000000000000 --- a/samples/client/petstore/crystal/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.19.0-SNAPSHOT -# - -language: crystal - -script: - - crystal spec -# uncomment below to check the code format -# - crystal tool format --check diff --git a/samples/client/petstore/crystal/README.md b/samples/client/petstore/crystal/README.md index 9b900c3e4772..627f5d4e9517 100644 --- a/samples/client/petstore/crystal/README.md +++ b/samples/client/petstore/crystal/README.md @@ -2,7 +2,7 @@ The Crystal module for the OpenAPI Petstore -This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: diff --git a/samples/client/petstore/crystal/bin/ameba b/samples/client/petstore/crystal/bin/ameba deleted file mode 100755 index e708bbed7199..000000000000 Binary files a/samples/client/petstore/crystal/bin/ameba and /dev/null differ diff --git a/samples/client/petstore/crystal/bin/ameba.cr b/samples/client/petstore/crystal/bin/ameba.cr deleted file mode 100644 index d61d0ff11a5c..000000000000 --- a/samples/client/petstore/crystal/bin/ameba.cr +++ /dev/null @@ -1,7 +0,0 @@ -# Require ameba cli which starts the inspection. -require "ameba/cli" - -# Require ameba extensions here which are added as project dependencies. -# Example: -# -# require "ameba-performance" diff --git a/samples/client/petstore/crystal/pet_compilation_error_spec.cr b/samples/client/petstore/crystal/pet_compilation_error_spec.cr deleted file mode 100644 index 519cb5b73e39..000000000000 --- a/samples/client/petstore/crystal/pet_compilation_error_spec.cr +++ /dev/null @@ -1,11 +0,0 @@ -require "./spec/spec_helper" -require "json" -require "time" - -describe Petstore::Pet do - describe "test an instance of Pet" do - it "should fail to compile if any required properties is missing" do - pet = Petstore::Pet.new(id: nil, category: nil, name: nil, photo_urls: Array(String).new, tags: nil, status: nil) - end - end -end diff --git a/samples/client/petstore/crystal/pom.xml b/samples/client/petstore/crystal/pom.xml deleted file mode 100644 index 29b7e4bc3516..000000000000 --- a/samples/client/petstore/crystal/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - 4.0.0 - org.openapitools - CrystalPetstoreClientTests - pom - 1.0-SNAPSHOT - Crystal OpenAPI Petstore Client - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 3.0.0 - - - shards-install - pre-integration-test - - exec - - - shards - - install - --ignore-crystal-version - - - - - crystal-spec - integration-test - - exec - - - crystal - - spec - - - - - - - - diff --git a/samples/client/petstore/crystal/shard.lock b/samples/client/petstore/crystal/shard.lock deleted file mode 100644 index 4bf5c767a160..000000000000 --- a/samples/client/petstore/crystal/shard.lock +++ /dev/null @@ -1,38 +0,0 @@ -version: 2.0 -shards: - ameba: - git: https://github.com/crystal-ameba/ameba.git - version: 1.6.4 - - backtracer: - git: https://github.com/sija/backtracer.cr.git - version: 1.2.4 - - crest: - git: https://github.com/mamantoha/crest.git - version: 1.3.13 - - exception_page: - git: https://github.com/crystal-loot/exception_page.git - version: 0.4.1 - - http-client-digest_auth: - git: https://github.com/mamantoha/http-client-digest_auth.git - version: 0.6.0 - - http_proxy: - git: https://github.com/mamantoha/http_proxy.git - version: 0.10.3 - - kemal: - git: https://github.com/kemalcr/kemal.git - version: 1.5.0 - - radix: - git: https://github.com/luislavena/radix.git - version: 0.4.1 - - spectator: - git: https://gitlab.com/arctic-fox/spectator.git - version: 0.12.1 - diff --git a/samples/client/petstore/crystal/shard.yml b/samples/client/petstore/crystal/shard.yml index 966c45d917fd..abbeb0097d1f 100644 --- a/samples/client/petstore/crystal/shard.yml +++ b/samples/client/petstore/crystal/shard.yml @@ -11,8 +11,6 @@ description: | crystal: ">= 0.35.1" dependencies: - any_hash: - github: Sija/any_hash.cr crest: github: mamantoha/crest version: ~> 1.3.13 diff --git a/samples/client/petstore/crystal/spec/api/another_fake_spec.cr b/samples/client/petstore/crystal/spec/api/another_fake_spec.cr new file mode 100644 index 000000000000..c687a3f9ba7e --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/another_fake_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::AnotherFake +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::AnotherFake" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::AnotherFake.new(client.connection) + expect(instance).to be_a(Petstore::Api::AnotherFake) + end +end diff --git a/samples/client/petstore/crystal/spec/api/fake_api_spec.cr b/samples/client/petstore/crystal/spec/api/fake_api_spec.cr deleted file mode 100644 index 4ed70284e185..000000000000 --- a/samples/client/petstore/crystal/spec/api/fake_api_spec.cr +++ /dev/null @@ -1,38 +0,0 @@ -# OpenAPI Petstore -# -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT -# - -require "../spec_helper" - -# Unit tests for Petstore::FakeApi -# Automatically generated by openapi-generator (https://openapi-generator.tech) -# Please update as you see appropriate -Spectator.describe "FakeApi" do - describe "test an instance of FakeApi" do - it "should create an instance of FakeApi" do - api_instance = Petstore::FakeApi.new - # TODO expect(api_instance).to be_instance_of(Petstore::FakeApi) - end - end - - # unit tests for get_parameter_name_mapping - # parameter name mapping test - # @param underscore_type _type - # @param _type type - # @param type_with_underscore type_ - # @param type_with_dash type- - # @param http_debug_option http debug option (to test parameter naming option) - # @param [Hash] opts the optional parameters - # @return [nil] - describe "get_parameter_name_mapping test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end -end diff --git a/samples/client/petstore/crystal/spec/api/fake_classname_test_spec.cr b/samples/client/petstore/crystal/spec/api/fake_classname_test_spec.cr new file mode 100644 index 000000000000..07fbeaa2599c --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/fake_classname_test_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::FakeClassnameTest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::FakeClassnameTest" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::FakeClassnameTest.new(client.connection) + expect(instance).to be_a(Petstore::Api::FakeClassnameTest) + end +end diff --git a/samples/client/petstore/crystal/spec/api/fake_spec.cr b/samples/client/petstore/crystal/spec/api/fake_spec.cr new file mode 100644 index 000000000000..c0f4d54ed62f --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/fake_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::Fake +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::Fake" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::Fake.new(client.connection) + expect(instance).to be_a(Petstore::Api::Fake) + end +end diff --git a/samples/client/petstore/crystal/spec/api/foo_spec.cr b/samples/client/petstore/crystal/spec/api/foo_spec.cr new file mode 100644 index 000000000000..7d985c9b39c3 --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/foo_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::Foo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::Foo" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::Foo.new(client.connection) + expect(instance).to be_a(Petstore::Api::Foo) + end +end diff --git a/samples/client/petstore/crystal/spec/api/pet_api_spec.cr b/samples/client/petstore/crystal/spec/api/pet_api_spec.cr deleted file mode 100644 index 0538667c22cd..000000000000 --- a/samples/client/petstore/crystal/spec/api/pet_api_spec.cr +++ /dev/null @@ -1,160 +0,0 @@ -# OpenAPI Petstore -# -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT -# - -require "../spec_helper" - -# Unit tests for Petstore::PetApi -# Automatically generated by openapi-generator (https://openapi-generator.tech) -# Please update as you see appropriate -Spectator.describe "PetApi" do - describe "test an instance of PetApi" do - it "should create an instance of PetApi" do - api_instance = Petstore::PetApi.new - # TODO expect(api_instance).to be_instance_of(Petstore::PetApi) - end - end - - # unit tests for add_pet - # Add a new pet to the store - # @param pet Pet object that needs to be added to the store - # @param [Hash] opts the optional parameters - # @return [Pet] - describe "add_pet test" do - it "should work with only required attributes" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - - config = Petstore::Configuration.new - config.access_token = "yyy" - config.api_key[:api_key] = "xxx" - config.api_key_prefix[:api_key] = "Token" - - api_client = Petstore::ApiClient.new(config) - - api_instance = Petstore::PetApi.new(api_client) - - pet_name = "new pet" - new_pet = Petstore::Pet.new(id: nil, category: nil, name: pet_name, photo_urls: Array(String).new, tags: nil, status: nil) - - pet = api_instance.add_pet(new_pet) - expect(pet.id).to_not be_nil - expect(pet.category).to be_nil - expect(pet.name).to eq pet_name - expect(pet.photo_urls).to eq Array(String).new - expect(pet.status).to be_nil - expect(pet.tags).to eq Array(Petstore::Tag).new - end - end - - # unit tests for delete_pet - # Deletes a pet - # @param pet_id Pet id to delete - # @param [Hash] opts the optional parameters - # @option opts [String] :api_key - # @return [nil] - describe "delete_pet test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for find_pets_by_status - # Finds Pets by status - # Multiple status values can be provided with comma separated strings - # @param status Status values that need to be considered for filter - # @param [Hash] opts the optional parameters - # @return [Array(Pet)] - describe "find_pets_by_status test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for find_pets_by_tags - # Finds Pets by tags - # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - # @param tags Tags to filter by - # @param [Hash] opts the optional parameters - # @return [Array(Pet)] - describe "find_pets_by_tags test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for get_pet_by_id - # Find pet by ID - # Returns a single pet - # @param pet_id ID of pet to return - # @param [Hash] opts the optional parameters - # @return [Pet] - describe "get_pet_by_id test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - - config = Petstore::Configuration.new - config.access_token = "yyy" - config.api_key[:api_key] = "xxx" - config.api_key_prefix[:api_key] = "Token" - - api_client = Petstore::ApiClient.new(config) - - api_instance = Petstore::PetApi.new(api_client) - - new_pet = Petstore::Pet.new(id: nil, category: nil, name: "crystal", photo_urls: Array(String).new, tags: nil, status: nil) - - pet = api_instance.add_pet(new_pet) - pet_id = pet.id.not_nil! - result = api_instance.get_pet_by_id(pet_id: pet_id) - expect(result.id).to eq pet_id - expect(result.category).to be_nil - expect(result.name).to eq "crystal" - expect(result.photo_urls).to eq Array(String).new - expect(result.status).to be_nil - expect(result.tags).to eq Array(Petstore::Tag).new - end - end - - # unit tests for update_pet - # Update an existing pet - # @param pet Pet object that needs to be added to the store - # @param [Hash] opts the optional parameters - # @return [Pet] - describe "update_pet test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for update_pet_with_form - # Updates a pet in the store with form data - # @param pet_id ID of pet that needs to be updated - # @param [Hash] opts the optional parameters - # @option opts [String] :name Updated name of the pet - # @option opts [String] :status Updated status of the pet - # @return [nil] - describe "update_pet_with_form test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for upload_file - # uploads an image - # @param pet_id ID of pet to update - # @param [Hash] opts the optional parameters - # @option opts [String] :additional_metadata Additional data to pass to server - # @option opts [File] :file file to upload - # @return [ApiResponse] - describe "upload_file test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end -end diff --git a/samples/client/petstore/crystal/spec/api/pet_spec.cr b/samples/client/petstore/crystal/spec/api/pet_spec.cr new file mode 100644 index 000000000000..41d16ceae3e2 --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/pet_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::Pet +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::Pet" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::Pet.new(client.connection) + expect(instance).to be_a(Petstore::Api::Pet) + end +end diff --git a/samples/client/petstore/crystal/spec/api/store/order_spec.cr b/samples/client/petstore/crystal/spec/api/store/order_spec.cr new file mode 100644 index 000000000000..142cf1ad3d4f --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/store/order_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../../spec_helper" + +# Unit tests for Petstore::Api::Store::Order +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::Store::Order" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::Store::Order.new(client.connection) + expect(instance).to be_a(Petstore::Api::Store::Order) + end +end diff --git a/samples/client/petstore/crystal/spec/api/store_api_spec.cr b/samples/client/petstore/crystal/spec/api/store_api_spec.cr deleted file mode 100644 index c5e4fc67dff9..000000000000 --- a/samples/client/petstore/crystal/spec/api/store_api_spec.cr +++ /dev/null @@ -1,70 +0,0 @@ -# OpenAPI Petstore -# -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT -# - -require "../spec_helper" - -# Unit tests for Petstore::StoreApi -# Automatically generated by openapi-generator (https://openapi-generator.tech) -# Please update as you see appropriate -Spectator.describe "StoreApi" do - describe "test an instance of StoreApi" do - it "should create an instance of StoreApi" do - api_instance = Petstore::StoreApi.new - # TODO expect(api_instance).to be_instance_of(Petstore::StoreApi) - end - end - - # unit tests for delete_order - # Delete purchase order by ID - # For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - # @param order_id ID of the order that needs to be deleted - # @param [Hash] opts the optional parameters - # @return [nil] - describe "delete_order test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for get_inventory - # Returns pet inventories by status - # Returns a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Hash(String, Int32)] - describe "get_inventory test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for get_order_by_id - # Find purchase order by ID - # For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - # @param order_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [Order] - describe "get_order_by_id test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for place_order - # Place an order for a pet - # - # @param order order placed for purchasing the pet - # @param [Hash] opts the optional parameters - # @return [Order] - describe "place_order test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end -end diff --git a/samples/client/petstore/crystal/spec/api/store_spec.cr b/samples/client/petstore/crystal/spec/api/store_spec.cr new file mode 100644 index 000000000000..be105229e4df --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/store_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::Store +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::Store" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::Store.new(client.connection) + expect(instance).to be_a(Petstore::Api::Store) + end +end diff --git a/samples/client/petstore/crystal/spec/api/user_api_spec.cr b/samples/client/petstore/crystal/spec/api/user_api_spec.cr deleted file mode 100644 index a126ae543a3c..000000000000 --- a/samples/client/petstore/crystal/spec/api/user_api_spec.cr +++ /dev/null @@ -1,120 +0,0 @@ -# OpenAPI Petstore -# -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT -# - -require "../spec_helper" - -# Unit tests for Petstore::UserApi -# Automatically generated by openapi-generator (https://openapi-generator.tech) -# Please update as you see appropriate -Spectator.describe "UserApi" do - describe "test an instance of UserApi" do - it "should create an instance of UserApi" do - api_instance = Petstore::UserApi.new - # TODO expect(api_instance).to be_instance_of(Petstore::UserApi) - end - end - - # unit tests for create_user - # Create user - # This can only be done by the logged in user. - # @param user Created user object - # @param [Hash] opts the optional parameters - # @return [nil] - describe "create_user test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for create_users_with_array_input - # Creates list of users with given input array - # - # @param user List of user object - # @param [Hash] opts the optional parameters - # @return [nil] - describe "create_users_with_array_input test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for create_users_with_list_input - # Creates list of users with given input array - # - # @param user List of user object - # @param [Hash] opts the optional parameters - # @return [nil] - describe "create_users_with_list_input test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for delete_user - # Delete user - # This can only be done by the logged in user. - # @param username The name that needs to be deleted - # @param [Hash] opts the optional parameters - # @return [nil] - describe "delete_user test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for get_user_by_name - # Get user by user name - # - # @param username The name that needs to be fetched. Use user1 for testing. - # @param [Hash] opts the optional parameters - # @return [User] - describe "get_user_by_name test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for login_user - # Logs user into the system - # - # @param username The user name for login - # @param password The password for login in clear text - # @param [Hash] opts the optional parameters - # @return [String] - describe "login_user test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for logout_user - # Logs out current logged in user session - # - # @param [Hash] opts the optional parameters - # @return [nil] - describe "logout_user test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - # unit tests for update_user - # Updated user - # This can only be done by the logged in user. - # @param username name that need to be deleted - # @param user Updated user object - # @param [Hash] opts the optional parameters - # @return [nil] - describe "update_user test" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end -end diff --git a/samples/client/petstore/crystal/spec/api/user_spec.cr b/samples/client/petstore/crystal/spec/api/user_spec.cr new file mode 100644 index 000000000000..aca65d283a2e --- /dev/null +++ b/samples/client/petstore/crystal/spec/api/user_spec.cr @@ -0,0 +1,23 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Api::User +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe "Api::User" do + # Structural test: the resource sub-client is constructible from a Connection + # obtained through the generated client facade. (No network: unit specs must + # not hit a server.) + it "is constructible from a Connection" do + client = Petstore::Client.new(host: "localhost") + instance = Petstore::Api::User.new(client.connection) + expect(instance).to be_a(Petstore::Api::User) + end +end diff --git a/samples/client/petstore/crystal/spec/api_client_spec.cr b/samples/client/petstore/crystal/spec/api_client_spec.cr deleted file mode 100644 index 767764436a92..000000000000 --- a/samples/client/petstore/crystal/spec/api_client_spec.cr +++ /dev/null @@ -1,59 +0,0 @@ -require "./spec_helper" - -Spectator.describe Petstore::ApiClient do - describe "#update_params_for_auth!" do - describe "oauth2" do - it "should add 'Authorization' to header" do - config = Petstore::Configuration.new - config.access_token = "xxx" - - header_params = {} of String => String - query_params = {} of String => String - cookie_params = {} of String => String - - api_client = Petstore::ApiClient.new(config) - api_client.update_params_for_auth!(header_params, query_params, cookie_params, ["petstore_auth"]) - - expect(header_params["Authorization"]).to eq "Bearer xxx" - expect(query_params.size).to eq 0 - end - end - - describe "api_key" do - context "without api_key_prefix" do - it "should add 'api_key' to header" do - config = Petstore::Configuration.new - config.api_key[:api_key] = "xxx" - - header_params = {} of String => String - query_params = {} of String => String - cookie_params = {} of String => String - - api_client = Petstore::ApiClient.new(config) - api_client.update_params_for_auth!(header_params, query_params, cookie_params, ["api_key"]) - - expect(header_params["api_key"]).to eq "xxx" - expect(query_params.empty?).to be_true - end - end - - context "with api_key_prefix" do - it "should add 'api_key' to header" do - config = Petstore::Configuration.new - config.api_key[:api_key] = "xxx" - config.api_key_prefix[:api_key] = "Token" - - header_params = {} of String => String - query_params = {} of String => String - cookie_params = {} of String => String - - api_client = Petstore::ApiClient.new(config) - api_client.update_params_for_auth!(header_params, query_params, cookie_params, ["api_key"]) - - expect(header_params["api_key"]).to eq "Token xxx" - expect(query_params.empty?).to be_true - end - end - end - end -end diff --git a/samples/client/petstore/crystal/spec/configuration_spec.cr b/samples/client/petstore/crystal/spec/configuration_spec.cr deleted file mode 100644 index a462dbf71a80..000000000000 --- a/samples/client/petstore/crystal/spec/configuration_spec.cr +++ /dev/null @@ -1,26 +0,0 @@ -require "./spec_helper" - -Spectator.describe Petstore::Configuration do - describe "#initialize" do - context "with block" do - it "works" do - config = Petstore::Configuration.new do |config| - config.username = "xxx" - end - - expect(config.username).to eq "xxx" - end - end - end - - describe "#configure" do - it "works" do - config = Petstore::Configuration.new - config.configure do |config| - config.username = "xxx" - end - - expect(config.username).to eq "xxx" - end - end -end diff --git a/samples/client/petstore/crystal/spec/integration/pet_spec.cr b/samples/client/petstore/crystal/spec/integration/pet_spec.cr new file mode 100644 index 000000000000..71b5e6230de0 --- /dev/null +++ b/samples/client/petstore/crystal/spec/integration/pet_spec.cr @@ -0,0 +1,36 @@ +require "../spec_helper" + +# Integration tests for the Pet resource sub-client. +# +# These exercise the generated client end-to-end against a live Petstore +# server. The CI workflow (.github/workflows/samples-crystal.yaml) starts a +# swaggerapi/petstore service container, reachable at http://localhost/v2 (the +# default below). Override PETSTORE_HOST / PETSTORE_SCHEME to run elsewhere. +# +# Hand-maintained: NOT produced by the generator. The generated specs under +# spec/api are structural-only and must never hit the network; this file +# provides the real round-trip coverage and is protected from regeneration +# via .openapi-generator-ignore. +Spectator.describe "Pet integration" do + it "persists a pet and reads it back by id" do + client = Petstore::Client.new( + host: ENV.fetch("PETSTORE_HOST", "localhost"), + scheme: ENV.fetch("PETSTORE_SCHEME", "http"), + ) + + pet_id = 90_000_i64 + pet = Petstore::Pet.new( + name: "crystal", + photo_urls: Set(String).new, + id: pet_id, + ) + + client.pet.create(pet) + + result = client.pet.get(pet_id).value + expect(result.id).to eq pet_id + expect(result.name).to eq "crystal" + expect(result.photo_urls).to eq Set(String).new + expect(result.status).to be_nil + end +end diff --git a/samples/client/petstore/crystal/spec/models/additional_properties_class_spec.cr b/samples/client/petstore/crystal/spec/models/additional_properties_class_spec.cr new file mode 100644 index 000000000000..a21bf14021fa --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/additional_properties_class_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::AdditionalPropertiesClass +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::AdditionalPropertiesClass do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::AdditionalPropertiesClass.from_json("{}") + expect(instance).to be_a(Petstore::AdditionalPropertiesClass) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::AdditionalPropertiesClass.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/all_of_with_single_ref_spec.cr b/samples/client/petstore/crystal/spec/models/all_of_with_single_ref_spec.cr new file mode 100644 index 000000000000..0fb4dd059989 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/all_of_with_single_ref_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::AllOfWithSingleRef +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::AllOfWithSingleRef do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::AllOfWithSingleRef.from_json("{}") + expect(instance).to be_a(Petstore::AllOfWithSingleRef) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::AllOfWithSingleRef.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/animal_spec.cr b/samples/client/petstore/crystal/spec/models/animal_spec.cr new file mode 100644 index 000000000000..15d900ce42b5 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/animal_spec.cr @@ -0,0 +1,22 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Animal +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Animal do + describe "polymorphic JSON" do + # A discriminated base type dispatches to a mapped subtype, so it cannot be built from a + # document that omits the discriminator field. + it "requires the discriminator to deserialise" do + expect { Petstore::Animal.from_json("{}") }.to raise_error + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/another_property_name_mapping_spec.cr b/samples/client/petstore/crystal/spec/models/another_property_name_mapping_spec.cr deleted file mode 100644 index 23de0b60455d..000000000000 --- a/samples/client/petstore/crystal/spec/models/another_property_name_mapping_spec.cr +++ /dev/null @@ -1,47 +0,0 @@ -# OpenAPI Petstore -# -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT -# - -require "../spec_helper" - -# Unit tests for Petstore::AnotherPropertyNameMapping -# Automatically generated by openapi-generator (https://openapi-generator.tech) -# Please update as you see appropriate -Spectator.describe Petstore::AnotherPropertyNameMapping do - describe "test an instance of AnotherPropertyNameMapping" do - it "should create an instance of AnotherPropertyNameMapping" do - # instance = Petstore::AnotherPropertyNameMapping.new - # expect(instance).to be_instance_of(Petstore::AnotherPropertyNameMapping) - end - end - - describe "test attribute 'http_debug_operation'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'underscore_type'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute '_type'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'type_with_underscore'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end -end diff --git a/samples/client/petstore/crystal/spec/models/api_response_spec.cr b/samples/client/petstore/crystal/spec/models/api_response_spec.cr index 14ad6b1b6aa2..8209df87ee8c 100644 --- a/samples/client/petstore/crystal/spec/models/api_response_spec.cr +++ b/samples/client/petstore/crystal/spec/models/api_response_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,28 +12,18 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::ApiResponse do - describe "test an instance of ApiResponse" do - it "should create an instance of ApiResponse" do - # instance = Petstore::ApiResponse.new - # expect(instance).to be_instance_of(Petstore::ApiResponse) - end - end - - describe "test attribute 'code'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute '_type'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ApiResponse.from_json("{}") + expect(instance).to be_a(Petstore::ApiResponse) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) end end - describe "test attribute 'message'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ApiResponse.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) end end end diff --git a/samples/client/petstore/crystal/spec/models/array_of_array_of_number_only_spec.cr b/samples/client/petstore/crystal/spec/models/array_of_array_of_number_only_spec.cr new file mode 100644 index 000000000000..d2bb0951dca0 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/array_of_array_of_number_only_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ArrayOfArrayOfNumberOnly +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ArrayOfArrayOfNumberOnly do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ArrayOfArrayOfNumberOnly.from_json("{}") + expect(instance).to be_a(Petstore::ArrayOfArrayOfNumberOnly) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ArrayOfArrayOfNumberOnly.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/array_of_number_only_spec.cr b/samples/client/petstore/crystal/spec/models/array_of_number_only_spec.cr new file mode 100644 index 000000000000..b6d22ea09a98 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/array_of_number_only_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ArrayOfNumberOnly +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ArrayOfNumberOnly do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ArrayOfNumberOnly.from_json("{}") + expect(instance).to be_a(Petstore::ArrayOfNumberOnly) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ArrayOfNumberOnly.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/array_test_spec.cr b/samples/client/petstore/crystal/spec/models/array_test_spec.cr new file mode 100644 index 000000000000..2686786703ca --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/array_test_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ArrayTest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ArrayTest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ArrayTest.from_json("{}") + expect(instance).to be_a(Petstore::ArrayTest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ArrayTest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/capitalization_spec.cr b/samples/client/petstore/crystal/spec/models/capitalization_spec.cr new file mode 100644 index 000000000000..f4cfe40c9997 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/capitalization_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Capitalization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Capitalization do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::Capitalization.from_json("{}") + expect(instance).to be_a(Petstore::Capitalization) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::Capitalization.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/cat_spec.cr b/samples/client/petstore/crystal/spec/models/cat_spec.cr new file mode 100644 index 000000000000..ca7005376146 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/cat_spec.cr @@ -0,0 +1,24 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Cat +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Cat do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::Cat.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/category_spec.cr b/samples/client/petstore/crystal/spec/models/category_spec.cr index 82d2527aaa5f..86a237ba0019 100644 --- a/samples/client/petstore/crystal/spec/models/category_spec.cr +++ b/samples/client/petstore/crystal/spec/models/category_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,22 +12,13 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::Category do - describe "test an instance of Category" do - it "should create an instance of Category" do - # instance = Petstore::Category.new - # expect(instance).to be_instance_of(Petstore::Category) - end - end - - describe "test attribute 'id'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'name'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::Category.from_json("{}") }.to raise_error(JSON::SerializableError) end end end diff --git a/samples/client/petstore/crystal/spec/models/child_with_nullable_spec.cr b/samples/client/petstore/crystal/spec/models/child_with_nullable_spec.cr new file mode 100644 index 000000000000..ecdf0d54f616 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/child_with_nullable_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ChildWithNullable +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ChildWithNullable do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ChildWithNullable.from_json("{}") + expect(instance).to be_a(Petstore::ChildWithNullable) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ChildWithNullable.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/class_model_spec.cr b/samples/client/petstore/crystal/spec/models/class_model_spec.cr new file mode 100644 index 000000000000..fcf5a7de4e15 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/class_model_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ClassModel +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ClassModel do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ClassModel.from_json("{}") + expect(instance).to be_a(Petstore::ClassModel) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ClassModel.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/deprecated_object_spec.cr b/samples/client/petstore/crystal/spec/models/deprecated_object_spec.cr new file mode 100644 index 000000000000..54cf71a81d24 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/deprecated_object_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::DeprecatedObject +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::DeprecatedObject do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::DeprecatedObject.from_json("{}") + expect(instance).to be_a(Petstore::DeprecatedObject) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::DeprecatedObject.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/dog_spec.cr b/samples/client/petstore/crystal/spec/models/dog_spec.cr new file mode 100644 index 000000000000..894e9b2032d1 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/dog_spec.cr @@ -0,0 +1,24 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Dog +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Dog do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::Dog.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/enum_arrays_spec.cr b/samples/client/petstore/crystal/spec/models/enum_arrays_spec.cr new file mode 100644 index 000000000000..bb0066d49610 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/enum_arrays_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::EnumArrays +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::EnumArrays do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::EnumArrays.from_json("{}") + expect(instance).to be_a(Petstore::EnumArrays) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::EnumArrays.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/enum_class_spec.cr b/samples/client/petstore/crystal/spec/models/enum_class_spec.cr new file mode 100644 index 000000000000..3a06e22cf71c --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/enum_class_spec.cr @@ -0,0 +1,21 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::EnumClass +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::EnumClass do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Petstore::EnumClass.from_json(%("_abc")) + expect(value).to be_a(Petstore::EnumClass) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/enum_test_spec.cr b/samples/client/petstore/crystal/spec/models/enum_test_spec.cr new file mode 100644 index 000000000000..6697c3024215 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/enum_test_spec.cr @@ -0,0 +1,24 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::EnumTest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::EnumTest do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::EnumTest.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/fake_big_decimal_map200_response_spec.cr b/samples/client/petstore/crystal/spec/models/fake_big_decimal_map200_response_spec.cr new file mode 100644 index 000000000000..8aa495595a77 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/fake_big_decimal_map200_response_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::FakeBigDecimalMap200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::FakeBigDecimalMap200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::FakeBigDecimalMap200Response.from_json("{}") + expect(instance).to be_a(Petstore::FakeBigDecimalMap200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::FakeBigDecimalMap200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/file_schema_test_class_spec.cr b/samples/client/petstore/crystal/spec/models/file_schema_test_class_spec.cr new file mode 100644 index 000000000000..add4a57554c8 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/file_schema_test_class_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::FileSchemaTestClass +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::FileSchemaTestClass do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::FileSchemaTestClass.from_json("{}") + expect(instance).to be_a(Petstore::FileSchemaTestClass) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::FileSchemaTestClass.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/file_spec.cr b/samples/client/petstore/crystal/spec/models/file_spec.cr new file mode 100644 index 000000000000..cb997a4b4861 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/file_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::File +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::File do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::File.from_json("{}") + expect(instance).to be_a(Petstore::File) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::File.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/foo_get_default_response_spec.cr b/samples/client/petstore/crystal/spec/models/foo_get_default_response_spec.cr new file mode 100644 index 000000000000..b922119bb5e2 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/foo_get_default_response_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::FooGetDefaultResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::FooGetDefaultResponse do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::FooGetDefaultResponse.from_json("{}") + expect(instance).to be_a(Petstore::FooGetDefaultResponse) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::FooGetDefaultResponse.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/foo_spec.cr b/samples/client/petstore/crystal/spec/models/foo_spec.cr new file mode 100644 index 000000000000..038195ddea4f --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/foo_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Foo +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Foo do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::Foo.from_json("{}") + expect(instance).to be_a(Petstore::Foo) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::Foo.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/format_test_spec.cr b/samples/client/petstore/crystal/spec/models/format_test_spec.cr index 6cc22cc964c1..d8a141f433b8 100644 --- a/samples/client/petstore/crystal/spec/models/format_test_spec.cr +++ b/samples/client/petstore/crystal/spec/models/format_test_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,106 +12,11 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::FormatTest do - describe "test an instance of FormatTest" do - it "should create an instance of FormatTest" do - # instance = Petstore::FormatTest.new - # expect(instance).to be_instance_of(Petstore::FormatTest) - end - end - - describe "test attribute 'integer'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'int32'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'int64'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'number'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'float'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'double'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'decimal'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'string'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'byte'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'binary'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'date'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'date_time'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'uuid'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'password'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'pattern_with_digits'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'pattern_with_digits_and_delimiter'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "JSON contract" do + # This model holds a non-JSON-serialisable property (e.g. a ::File field), so a + # from_json round-trip cannot be compiled. Assert the JSON contract is present instead. + it "defines from_json" do + expect(Petstore::FormatTest.responds_to?(:from_json)).to be_true end end end diff --git a/samples/client/petstore/crystal/spec/models/has_only_read_only_spec.cr b/samples/client/petstore/crystal/spec/models/has_only_read_only_spec.cr new file mode 100644 index 000000000000..9ce7f064a811 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/has_only_read_only_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::HasOnlyReadOnly +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::HasOnlyReadOnly do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::HasOnlyReadOnly.from_json("{}") + expect(instance).to be_a(Petstore::HasOnlyReadOnly) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::HasOnlyReadOnly.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/health_check_result_spec.cr b/samples/client/petstore/crystal/spec/models/health_check_result_spec.cr new file mode 100644 index 000000000000..f3c51c67cf26 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/health_check_result_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::HealthCheckResult +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::HealthCheckResult do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::HealthCheckResult.from_json("{}") + expect(instance).to be_a(Petstore::HealthCheckResult) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::HealthCheckResult.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/list_spec.cr b/samples/client/petstore/crystal/spec/models/list_spec.cr new file mode 100644 index 000000000000..4583fce55658 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/list_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::List +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::List do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::List.from_json("{}") + expect(instance).to be_a(Petstore::List) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::List.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/map_test_spec.cr b/samples/client/petstore/crystal/spec/models/map_test_spec.cr new file mode 100644 index 000000000000..fd51dab770c2 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/map_test_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::MapTest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::MapTest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::MapTest.from_json("{}") + expect(instance).to be_a(Petstore::MapTest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::MapTest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/mixed_properties_and_additional_properties_class_spec.cr b/samples/client/petstore/crystal/spec/models/mixed_properties_and_additional_properties_class_spec.cr new file mode 100644 index 000000000000..f085b2077d4a --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/mixed_properties_and_additional_properties_class_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::MixedPropertiesAndAdditionalPropertiesClass +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::MixedPropertiesAndAdditionalPropertiesClass do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::MixedPropertiesAndAdditionalPropertiesClass.from_json("{}") + expect(instance).to be_a(Petstore::MixedPropertiesAndAdditionalPropertiesClass) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::MixedPropertiesAndAdditionalPropertiesClass.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/model200_response_spec.cr b/samples/client/petstore/crystal/spec/models/model200_response_spec.cr new file mode 100644 index 000000000000..f64a5487c897 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/model200_response_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Model200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Model200Response do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::Model200Response.from_json("{}") + expect(instance).to be_a(Petstore::Model200Response) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::Model200Response.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/model_client_spec.cr b/samples/client/petstore/crystal/spec/models/model_client_spec.cr new file mode 100644 index 000000000000..81a1f2242c59 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/model_client_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ModelClient +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ModelClient do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ModelClient.from_json("{}") + expect(instance).to be_a(Petstore::ModelClient) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ModelClient.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/model_return_spec.cr b/samples/client/petstore/crystal/spec/models/model_return_spec.cr new file mode 100644 index 000000000000..0e1224f94222 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/model_return_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ModelReturn +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ModelReturn do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ModelReturn.from_json("{}") + expect(instance).to be_a(Petstore::ModelReturn) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ModelReturn.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/name_spec.cr b/samples/client/petstore/crystal/spec/models/name_spec.cr new file mode 100644 index 000000000000..3ca3cd329c76 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/name_spec.cr @@ -0,0 +1,24 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::Name +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::Name do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::Name.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/nullable_class_spec.cr b/samples/client/petstore/crystal/spec/models/nullable_class_spec.cr new file mode 100644 index 000000000000..32da2ba5e7aa --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/nullable_class_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::NullableClass +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::NullableClass do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::NullableClass.from_json("{}") + expect(instance).to be_a(Petstore::NullableClass) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::NullableClass.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/number_only_spec.cr b/samples/client/petstore/crystal/spec/models/number_only_spec.cr new file mode 100644 index 000000000000..d16e51125303 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/number_only_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::NumberOnly +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::NumberOnly do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::NumberOnly.from_json("{}") + expect(instance).to be_a(Petstore::NumberOnly) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::NumberOnly.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/object_with_deprecated_fields_spec.cr b/samples/client/petstore/crystal/spec/models/object_with_deprecated_fields_spec.cr new file mode 100644 index 000000000000..a5dea2c3b727 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/object_with_deprecated_fields_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ObjectWithDeprecatedFields +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ObjectWithDeprecatedFields do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ObjectWithDeprecatedFields.from_json("{}") + expect(instance).to be_a(Petstore::ObjectWithDeprecatedFields) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ObjectWithDeprecatedFields.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/order_spec.cr b/samples/client/petstore/crystal/spec/models/order_spec.cr index 31bc80a8f66b..86952a92c78b 100644 --- a/samples/client/petstore/crystal/spec/models/order_spec.cr +++ b/samples/client/petstore/crystal/spec/models/order_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,50 +12,18 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::Order do - describe "test an instance of Order" do - it "should create an instance of Order" do - # instance = Petstore::Order.new - # expect(instance).to be_instance_of(Petstore::Order) - end - end - - describe "test attribute 'id'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'pet_id'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'quantity'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'ship_date'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'status'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - # validator = Petstore::EnumTest::EnumAttributeValidator.new("String", ["placed", "approved", "delivered"]) - # validator.allowable_values.each do |value| - # expect { instance.status = value }.not_to raise_error - # end + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::Order.from_json("{}") + expect(instance).to be_a(Petstore::Order) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) end end - describe "test attribute 'complete'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::Order.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) end end end diff --git a/samples/client/petstore/crystal/spec/models/outer_composite_spec.cr b/samples/client/petstore/crystal/spec/models/outer_composite_spec.cr new file mode 100644 index 000000000000..cb8b38004b60 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/outer_composite_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::OuterComposite +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::OuterComposite do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::OuterComposite.from_json("{}") + expect(instance).to be_a(Petstore::OuterComposite) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::OuterComposite.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/outer_enum_default_value_spec.cr b/samples/client/petstore/crystal/spec/models/outer_enum_default_value_spec.cr new file mode 100644 index 000000000000..0ebd718c536f --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/outer_enum_default_value_spec.cr @@ -0,0 +1,21 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::OuterEnumDefaultValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::OuterEnumDefaultValue do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Petstore::OuterEnumDefaultValue.from_json(%("placed")) + expect(value).to be_a(Petstore::OuterEnumDefaultValue) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/outer_enum_integer_default_value_spec.cr b/samples/client/petstore/crystal/spec/models/outer_enum_integer_default_value_spec.cr new file mode 100644 index 000000000000..a34206730ef0 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/outer_enum_integer_default_value_spec.cr @@ -0,0 +1,21 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::OuterEnumIntegerDefaultValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::OuterEnumIntegerDefaultValue do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Petstore::OuterEnumIntegerDefaultValue.from_json(%(0)) + expect(value).to be_a(Petstore::OuterEnumIntegerDefaultValue) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/outer_enum_integer_spec.cr b/samples/client/petstore/crystal/spec/models/outer_enum_integer_spec.cr new file mode 100644 index 000000000000..5918e4bc6b80 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/outer_enum_integer_spec.cr @@ -0,0 +1,21 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::OuterEnumInteger +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::OuterEnumInteger do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Petstore::OuterEnumInteger.from_json(%(0)) + expect(value).to be_a(Petstore::OuterEnumInteger) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/outer_enum_spec.cr b/samples/client/petstore/crystal/spec/models/outer_enum_spec.cr new file mode 100644 index 000000000000..e6f478a40523 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/outer_enum_spec.cr @@ -0,0 +1,21 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::OuterEnum +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::OuterEnum do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Petstore::OuterEnum.from_json(%("placed")) + expect(value).to be_a(Petstore::OuterEnum) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/outer_object_with_enum_property_spec.cr b/samples/client/petstore/crystal/spec/models/outer_object_with_enum_property_spec.cr new file mode 100644 index 000000000000..2a0c52adf8db --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/outer_object_with_enum_property_spec.cr @@ -0,0 +1,24 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::OuterObjectWithEnumProperty +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::OuterObjectWithEnumProperty do + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::OuterObjectWithEnumProperty.from_json("{}") }.to raise_error(JSON::SerializableError) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/parent_with_nullable_spec.cr b/samples/client/petstore/crystal/spec/models/parent_with_nullable_spec.cr new file mode 100644 index 000000000000..e2fd469a7c72 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/parent_with_nullable_spec.cr @@ -0,0 +1,22 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ParentWithNullable +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ParentWithNullable do + describe "polymorphic JSON" do + # A discriminated base type dispatches to a mapped subtype, so it cannot be built from a + # document that omits the discriminator field. + it "requires the discriminator to deserialise" do + expect { Petstore::ParentWithNullable.from_json("{}") }.to raise_error + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/pet_spec.cr b/samples/client/petstore/crystal/spec/models/pet_spec.cr index 66650f6ad855..c4350785b2ff 100644 --- a/samples/client/petstore/crystal/spec/models/pet_spec.cr +++ b/samples/client/petstore/crystal/spec/models/pet_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,87 +12,13 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::Pet do - describe "test an instance of Pet" do - # it "should fail to compile if any required properties is missing" do - # assert_compilation_error(path: "./pet_compilation_error_spec.cr", message: "Error: expected argument 'name' to 'Petstore::Pet.new' to be String, not Nil") - # end - - it "should create an instance of Pet with only required properties" do - pet = Petstore::Pet.new(id: nil, category: nil, name: "new pet", photo_urls: Array(String).new, tags: nil, status: nil) - expect(pet).to be_a(Petstore::Pet) - end - - it "should create an instance of Pet with all properties" do - pet_id = 12345_i64 - pet = Petstore::Pet.new(id: pet_id, category: Petstore::Category.new(id: pet_id + 10, name: "crystal category"), name: "crystal", photo_urls: ["https://crystal-lang.org"], tags: [Petstore::Tag.new(id: pet_id + 100, name: "crystal tag")], status: "available") - expect(pet).to be_a(Petstore::Pet) - end - end - - describe "#from_json" do - it "should instantiate a new instance from json string with required properties" do - pet = Petstore::Pet.from_json("{\"name\": \"json pet\", \"photoUrls\": []}") - expect(pet).to be_a(Petstore::Pet) - expect(pet.name).to eq "json pet" - expect(pet.photo_urls).to eq Array(String).new - end - - it "should raise error when instantiating a new instance from json string with missing required properties" do - expect_raises(JSON::SerializableError, /Missing JSON attribute: name/) do - Petstore::Pet.from_json("{\"photoUrls\": []}") - end - expect_raises(JSON::SerializableError, /Missing JSON attribute: photoUrls/) do - Petstore::Pet.from_json("{\"name\": \"json pet\"}") - end - end - - it "should raise error when instantiating a new instance from json string with required properties set to null value" do - expect_raises(JSON::SerializableError, /Expected String but was Null/) do - Petstore::Pet.from_json("{\"name\": null, \"photoUrls\": []}") - end - expect_raises(JSON::SerializableError, /Expected BeginArray but was Null/) do - Petstore::Pet.from_json("{\"name\": \"json pet\", \"photoUrls\": null}") - end - end - end - - describe "test attribute 'id'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'category'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'name'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'photo_urls'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'tags'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'status'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - # validator = Petstore::EnumTest::EnumAttributeValidator.new("String", ["available", "pending", "sold"]) - # validator.allowable_values.each do |value| - # expect { instance.status = value }.not_to raise_error - # end + describe "required-field enforcement" do + # A required, non-nilable property without a default makes JSON::Serializable + # reject a document that omits it. (Assumes at least one required field has no + # default; models where every required field has a default are not present in + # the generated samples.) + it "raises when required properties are missing" do + expect { Petstore::Pet.from_json("{}") }.to raise_error(JSON::SerializableError) end end end diff --git a/samples/client/petstore/crystal/spec/models/read_only_first_spec.cr b/samples/client/petstore/crystal/spec/models/read_only_first_spec.cr new file mode 100644 index 000000000000..1f267a85b9fe --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/read_only_first_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::ReadOnlyFirst +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::ReadOnlyFirst do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::ReadOnlyFirst.from_json("{}") + expect(instance).to be_a(Petstore::ReadOnlyFirst) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::ReadOnlyFirst.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/single_ref_type_spec.cr b/samples/client/petstore/crystal/spec/models/single_ref_type_spec.cr new file mode 100644 index 000000000000..203c4b28dbd0 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/single_ref_type_spec.cr @@ -0,0 +1,21 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::SingleRefType +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::SingleRefType do + describe "JSON round-trip" do + it "parses an allowed value" do + value = Petstore::SingleRefType.from_json(%("admin")) + expect(value).to be_a(Petstore::SingleRefType) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/special_model_name_spec.cr b/samples/client/petstore/crystal/spec/models/special_model_name_spec.cr new file mode 100644 index 000000000000..dad17ab38739 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/special_model_name_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::SpecialModelName +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::SpecialModelName do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::SpecialModelName.from_json("{}") + expect(instance).to be_a(Petstore::SpecialModelName) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::SpecialModelName.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/tag_spec.cr b/samples/client/petstore/crystal/spec/models/tag_spec.cr index d500aa8309d0..bab85594204c 100644 --- a/samples/client/petstore/crystal/spec/models/tag_spec.cr +++ b/samples/client/petstore/crystal/spec/models/tag_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,36 +12,18 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::Tag do - describe "test an instance of Tag" do - it "should create an instance of Tag" do - # instance = Petstore::Tag.new - # expect(instance).to be_instance_of(Petstore::Tag) - end - end - - describe "test equality of Tag instances" do - it "should equal to itself" do - tag1 = Petstore::Tag.new(id: 0, name: "same") - tag2 = tag1 - expect(tag1 == tag2).to be_true - end - - it "should equal to another instance with same attributes" do - tag1 = Petstore::Tag.new(id: 0, name: "tag") - tag2 = Petstore::Tag.new(id: 0, name: "tag") - expect(tag1 == tag2).to be_true - end - end - - describe "test attribute 'id'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::Tag.from_json("{}") + expect(instance).to be_a(Petstore::Tag) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) end end - describe "test attribute 'name'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::Tag.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) end end end diff --git a/samples/client/petstore/crystal/spec/models/test_inline_freeform_additional_properties_request_spec.cr b/samples/client/petstore/crystal/spec/models/test_inline_freeform_additional_properties_request_spec.cr new file mode 100644 index 000000000000..fd96bd609534 --- /dev/null +++ b/samples/client/petstore/crystal/spec/models/test_inline_freeform_additional_properties_request_spec.cr @@ -0,0 +1,29 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +require "../spec_helper" + +# Unit tests for Petstore::TestInlineFreeformAdditionalPropertiesRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +Spectator.describe Petstore::TestInlineFreeformAdditionalPropertiesRequest do + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::TestInlineFreeformAdditionalPropertiesRequest.from_json("{}") + expect(instance).to be_a(Petstore::TestInlineFreeformAdditionalPropertiesRequest) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) + end + end + + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::TestInlineFreeformAdditionalPropertiesRequest.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) + end + end +end diff --git a/samples/client/petstore/crystal/spec/models/user_spec.cr b/samples/client/petstore/crystal/spec/models/user_spec.cr index 981cd52d271e..244937ad9d50 100644 --- a/samples/client/petstore/crystal/spec/models/user_spec.cr +++ b/samples/client/petstore/crystal/spec/models/user_spec.cr @@ -1,11 +1,9 @@ -# OpenAPI Petstore +# #OpenAPI Petstore # -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +#The version of the OpenAPI document: 1.0.0 # -# The version of the OpenAPI document: 1.0.0 -# -# Generated by: https://openapi-generator.tech -# Generator version: 7.11.0-SNAPSHOT +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT # require "../spec_helper" @@ -14,58 +12,18 @@ require "../spec_helper" # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate Spectator.describe Petstore::User do - describe "test an instance of User" do - it "should create an instance of User" do - # instance = Petstore::User.new - # expect(instance).to be_instance_of(Petstore::User) - end - end - - describe "test attribute 'id'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'username'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'first_name'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'last_name'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'email'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'password'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html - end - end - - describe "test attribute 'phone'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "JSON round-trip" do + it "parses an empty JSON object and re-serialises to valid JSON" do + instance = Petstore::User.from_json("{}") + expect(instance).to be_a(Petstore::User) + expect(JSON.parse(instance.to_json)).to be_a(JSON::Any) end end - describe "test attribute 'user_status'" do - it "should work" do - # assertion here. ref: https://crystal-lang.org/reference/guides/testing.html + describe "#to_h" do + it "returns a Hash representation" do + instance = Petstore::User.from_json("{}") + expect(instance.to_h).to be_a(Hash(String, JSON::Any)) end end end diff --git a/samples/client/petstore/crystal/spec/petstore_spec.cr b/samples/client/petstore/crystal/spec/petstore_spec.cr deleted file mode 100644 index 59d84e903198..000000000000 --- a/samples/client/petstore/crystal/spec/petstore_spec.cr +++ /dev/null @@ -1,19 +0,0 @@ -require "./spec_helper" - -Spectator.describe Petstore do - describe "#configure" do - it "works" do - Petstore.configure do |config| - config.username = "xxx" - end - - config = Petstore.configure - - expect(config).to eq Petstore::Configuration.default - expect(config.username).to eq "xxx" - - # Clean up - Petstore::Configuration.default.username = nil - end - end -end diff --git a/samples/client/petstore/crystal/spec/spec_helper.cr b/samples/client/petstore/crystal/spec/spec_helper.cr index 62f406a3a01a..4f9db1d993f5 100644 --- a/samples/client/petstore/crystal/spec/spec_helper.cr +++ b/samples/client/petstore/crystal/spec/spec_helper.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/crystal/src/petstore.cr b/samples/client/petstore/crystal/src/petstore.cr index 45c488246d26..dc1f90e12952 100644 --- a/samples/client/petstore/crystal/src/petstore.cr +++ b/samples/client/petstore/crystal/src/petstore.cr @@ -1,45 +1,85 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech #Generator version: 7.24.0-SNAPSHOT # - -# Stdlib dependencies require "big" +require "big/json" require "json" require "log" require "time" +require "uri" require "yaml" -# External dependencies -require "any_hash" -require "crest" - -module Petstore - Log = ::Log.for("Petstore") # => Log for Petstore source - - VERSION = {{ `shards version #{__DIR__}`.chomp.stringify }} +require "./petstore/configuration" +require "./petstore/connection" +require "./petstore/response" +require "./petstore/api_error" +require "./petstore/client" +require "./petstore/serializable" +require "./petstore/validation" - # Return the default `Configuration` object. - def self.configure - Configuration.default - end +# Models +require "./petstore/models/additional_properties_class" +require "./petstore/models/all_of_with_single_ref" +require "./petstore/models/animal" +require "./petstore/models/api_response" +require "./petstore/models/array_of_array_of_number_only" +require "./petstore/models/array_of_number_only" +require "./petstore/models/array_test" +require "./petstore/models/capitalization" +require "./petstore/models/cat" +require "./petstore/models/category" +require "./petstore/models/parent_with_nullable" +require "./petstore/models/child_with_nullable" +require "./petstore/models/class_model" +require "./petstore/models/deprecated_object" +require "./petstore/models/dog" +require "./petstore/models/enum_arrays" +require "./petstore/models/enum_class" +require "./petstore/models/enum_test" +require "./petstore/models/fake_big_decimal_map200_response" +require "./petstore/models/file" +require "./petstore/models/file_schema_test_class" +require "./petstore/models/foo" +require "./petstore/models/foo_get_default_response" +require "./petstore/models/format_test" +require "./petstore/models/has_only_read_only" +require "./petstore/models/health_check_result" +require "./petstore/models/list" +require "./petstore/models/map_test" +require "./petstore/models/mixed_properties_and_additional_properties_class" +require "./petstore/models/model200_response" +require "./petstore/models/model_client" +require "./petstore/models/model_return" +require "./petstore/models/name" +require "./petstore/models/nullable_class" +require "./petstore/models/number_only" +require "./petstore/models/object_with_deprecated_fields" +require "./petstore/models/order" +require "./petstore/models/outer_composite" +require "./petstore/models/outer_enum" +require "./petstore/models/outer_enum_default_value" +require "./petstore/models/outer_enum_integer" +require "./petstore/models/outer_enum_integer_default_value" +require "./petstore/models/outer_object_with_enum_property" +require "./petstore/models/pet" +require "./petstore/models/read_only_first" +require "./petstore/models/single_ref_type" +require "./petstore/models/special_model_name" +require "./petstore/models/tag" +require "./petstore/models/test_inline_freeform_additional_properties_request" +require "./petstore/models/user" - # Customize default settings for the SDK using block. - # - # ``` - # Petstore.configure do |config| - # config.username = "xxx" - # config.password = "xxx" - # end - # ``` - def self.configure - yield Configuration.default - end -end +# APIs +require "./petstore/api/another_fake" +require "./petstore/api/fake" +require "./petstore/api/fake_classname_test" +require "./petstore/api/foo" +require "./petstore/api/pet" +require "./petstore/api/store" +require "./petstore/api/store/order" +require "./petstore/api/user" -require "./petstore/**" diff --git a/samples/client/petstore/crystal/src/petstore/api/another_fake.cr b/samples/client/petstore/crystal/src/petstore/api/another_fake.cr new file mode 100644 index 000000000000..8b0404119f4e --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/another_fake.cr @@ -0,0 +1,21 @@ +require "json" + +module Petstore + module Api + class AnotherFake + def initialize(@conn : Connection); end + + # To test special tags To test special tags and operation ID starting with number + def dummy(model_client : Petstore::ModelClient) : Response(Petstore::ModelClient) + @conn.request(Petstore::ModelClient, + method: :PATCH, + path: "/another-fake/dummy", + body: model_client, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/fake.cr b/samples/client/petstore/crystal/src/petstore/api/fake.cr new file mode 100644 index 000000000000..a66176acc56d --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/fake.cr @@ -0,0 +1,265 @@ +require "json" + +module Petstore + module Api + class Fake + def initialize(@conn : Connection); end + + # test referenced additionalProperties + def additional_properties_reference(request_body : Hash(String, JSON::Any)) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/fake/additionalProperties-reference", + body: request_body, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + def big_decimal_map() : Response(Petstore::FakeBigDecimalMap200Response) + @conn.request(Petstore::FakeBigDecimalMap200Response, + method: :GET, + path: "/fake/BigDecimalMap", + accept: %w[*/*], + raw: true, + auth: %w[]) + end + + # For this test, the body has to be a binary file. + def body_with_binary(body : ::File) : Response(Nil) + @conn.request(Nil, + method: :PUT, + path: "/fake/body-with-binary", + body: body, + accept: %w[], + content_type: %w[image/png], + auth: %w[]) + end + + # For this test, the body for this request must reference a schema named `File`. + def body_with_file_schema(file_schema_test_class : Petstore::FileSchemaTestClass) : Response(Nil) + @conn.request(Nil, + method: :PUT, + path: "/fake/body-with-file-schema", + body: file_schema_test_class, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # + def body_with_query_params(user : Petstore::User, *, query : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :PUT, + path: "/fake/body-with-query-params", + body: user, + query: { "query" => query }, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + def bulk_destroy(*, required_boolean_group : Bool? = nil, boolean_group : Bool? = nil, required_string_group : Int32? = nil, required_int64_group : Int64? = nil, string_group : Int32? = nil, int64_group : Int64? = nil) : Response(Nil) + @conn.request(Nil, + method: :DELETE, + path: "/fake", + header: { "required_boolean_group" => required_boolean_group.try &.to_s, "boolean_group" => boolean_group.try &.to_s }, + query: { "required_string_group" => required_string_group, "required_int64_group" => required_int64_group, "string_group" => string_group, "int64_group" => int64_group }, + accept: %w[], + auth: %w[bearer_test]) + end + + # To test \"client\" model To test \"client\" model + def bulk_partial_update(model_client : Petstore::ModelClient) : Response(Petstore::ModelClient) + @conn.request(Petstore::ModelClient, + method: :PATCH, + path: "/fake", + body: model_client, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[]) + end + + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + def create(integer : Int32? = nil, int32 : Int32? = nil, int64 : Int64? = nil, number : Float64? = nil, float : Float32? = nil, double : Float64? = nil, string : String? = nil, pattern_without_delimiter : String? = nil, byte : String? = nil, binary : ::File? = nil, date : Time? = nil, date_time : Time? = nil, password : String? = nil, callback : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/fake", + form: Hash(String, Crest::ParamsValue){ "integer" => integer, "int32" => int32, "int64" => int64, "number" => number, "float" => float, "double" => double, "string" => string, "pattern_without_delimiter" => pattern_without_delimiter, "byte" => byte, "binary" => binary, "date" => date, "dateTime" => date_time, "password" => password, "callback" => callback }, + accept: %w[], + auth: %w[http_basic_test]) + end + + # Health check endpoint + def health_get() : Response(Petstore::HealthCheckResult) + @conn.request(Petstore::HealthCheckResult, + method: :GET, + path: "/fake/health", + accept: %w[application/json], + auth: %w[]) + end + + # test http signature authentication + def http_signature_test(pet : Petstore::Pet, *, header_1 : String? = nil, query_1 : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :GET, + path: "/fake/http-signature-test", + body: pet, + header: { "header_1" => header_1.try &.to_s }, + query: { "query_1" => query_1 }, + accept: %w[], + content_type: %w[application/json application/xml], + auth: %w[http_signature_test]) + end + + # test inline additionalProperties + def inline_additional_properties(request_body : Hash(String, String)) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/fake/inline-additionalProperties", + body: request_body, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # test inline free-form additionalProperties + def inline_freeform_additional_properties(test_inline_freeform_additional_properties_request : Petstore::TestInlineFreeformAdditionalPropertiesRequest) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/fake/inline-freeform-additionalProperties", + body: test_inline_freeform_additional_properties_request, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # test json serialization of form data + def json_form_data(param : String? = nil, param2 : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :GET, + path: "/fake/jsonFormData", + form: Hash(String, Crest::ParamsValue){ "param" => param, "param2" => param2 }, + accept: %w[], + auth: %w[]) + end + + # To test enum parameters To test enum parameters + def list(enum_form_string_array : Array(String)? = nil, enum_form_string : String? = nil, *, enum_header_string_array : Array(String)? = nil, enum_header_string : String? = nil, enum_query_string_array : Array(String)? = nil, enum_query_string : String? = nil, enum_query_integer : Int32? = nil, enum_query_double : Float64? = nil, enum_query_model_array : Array(Petstore::EnumClass)? = nil) : Response(Nil) + @conn.request(Nil, + method: :GET, + path: "/fake", + header: { "enum_header_string_array" => enum_header_string_array.try &.to_s, "enum_header_string" => enum_header_string.try &.to_s }, + query: { "enum_query_string_array" => enum_query_string_array, "enum_query_string" => enum_query_string, "enum_query_integer" => enum_query_integer, "enum_query_double" => enum_query_double, "enum_query_model_array" => enum_query_model_array }, + form: Hash(String, Crest::ParamsValue){ "enum_form_string_array" => enum_form_string_array, "enum_form_string" => enum_form_string }, + accept: %w[], + auth: %w[]) + end + + # test nullable parent property + def nullable(child_with_nullable : Petstore::ChildWithNullable) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/fake/nullable", + body: child_with_nullable, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # Test serialization of outer boolean types + def outer_boolean_serialize(body : Bool? = nil) : Response(Bool) + @conn.request(Bool, + method: :POST, + path: "/fake/outer/boolean", + body: body, + accept: %w[*/*], + content_type: %w[application/json], + raw: true, + auth: %w[]) + end + + # Test serialization of object with outer number type + def outer_composite_serialize(outer_composite : Petstore::OuterComposite? = nil) : Response(Petstore::OuterComposite) + @conn.request(Petstore::OuterComposite, + method: :POST, + path: "/fake/outer/composite", + body: outer_composite, + accept: %w[*/*], + content_type: %w[application/json], + raw: true, + auth: %w[]) + end + + # Test serialization of outer number types + def outer_number_serialize(body : Float64? = nil) : Response(Float64) + @conn.request(Float64, + method: :POST, + path: "/fake/outer/number", + body: body, + accept: %w[*/*], + content_type: %w[application/json], + raw: true, + auth: %w[]) + end + + # Test serialization of outer string types + def outer_string_serialize(body : String? = nil) : Response(String) + @conn.request(String, + method: :POST, + path: "/fake/outer/string", + body: body, + accept: %w[*/*], + content_type: %w[application/json], + raw: true, + auth: %w[]) + end + + # Test serialization of enum (int) properties with examples + def property_enum_integer_serialize(outer_object_with_enum_property : Petstore::OuterObjectWithEnumProperty) : Response(Petstore::OuterObjectWithEnumProperty) + @conn.request(Petstore::OuterObjectWithEnumProperty, + method: :POST, + path: "/fake/property/enum-int", + body: outer_object_with_enum_property, + accept: %w[*/*], + content_type: %w[application/json], + raw: true, + auth: %w[]) + end + + # test referenced string map + def string_map_reference(request_body : Hash(String, String)) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/fake/stringMap-reference", + body: request_body, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # To test the collection format in query parameters + def test_query_parameters(*, pipe : Array(String)? = nil, ioutil : Array(String)? = nil, http : Array(String)? = nil, url : Array(String)? = nil, context : Array(String)? = nil, language : Hash(String, String)? = nil, allow_empty : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :PUT, + path: "/fake/test-query-parameters", + query: { "pipe" => pipe.try(&.map(&.to_s).join("|")), "ioutil" => ioutil.try(&.map(&.to_s).join(",")), "http" => http.try(&.map(&.to_s).join(" ")), "url" => url.try(&.map(&.to_s).join(",")), "context" => context, "language" => language, "allowEmpty" => allow_empty }, + accept: %w[], + auth: %w[]) + end + + # uploads an image (required) + def upload_image_with_required_file(pet_id : Int64, additional_metadata : String? = nil, required_file : ::File? = nil) : Response(Petstore::ApiResponse) + @conn.request(Petstore::ApiResponse, + method: :POST, + path: "/fake/{petId}/uploadImageWithRequiredFile".sub("{petId}", Petstore.enc(pet_id)), + form: Hash(String, Crest::ParamsValue){ "additionalMetadata" => additional_metadata, "requiredFile" => required_file }, + accept: %w[application/json], + auth: %w[petstore_auth]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/fake_api.cr b/samples/client/petstore/crystal/src/petstore/api/fake_api.cr deleted file mode 100644 index 54a83885d6fb..000000000000 --- a/samples/client/petstore/crystal/src/petstore/api/fake_api.cr +++ /dev/null @@ -1,108 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.24.0-SNAPSHOT -# - -require "uri" - -module Petstore - class FakeApi - property api_client : ApiClient - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # parameter name mapping test - # @param underscore_type [Int64] _type - # @param _type [String] type - # @param type_with_underscore [String] type_ - # @param type_with_dash [String] type- - # @param http_debug_option [String] http debug option (to test parameter naming option) - # @return [nil] - def get_parameter_name_mapping(underscore_type : Int64, _type : String, type_with_underscore : String, type_with_dash : String, http_debug_option : String) - get_parameter_name_mapping_with_http_info(underscore_type, _type, type_with_underscore, type_with_dash, http_debug_option) - nil - end - - # parameter name mapping test - # @param underscore_type [Int64] _type - # @param _type [String] type - # @param type_with_underscore [String] type_ - # @param type_with_dash [String] type- - # @param http_debug_option [String] http debug option (to test parameter naming option) - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def get_parameter_name_mapping_with_http_info(underscore_type : Int64, _type : String, type_with_underscore : String, type_with_dash : String, http_debug_option : String) - if @api_client.config.debugging - Log.debug {"Calling API: FakeApi.get_parameter_name_mapping ..."} - end - # verify the required parameter "underscore_type" is set - if @api_client.config.client_side_validation && underscore_type.nil? - raise ArgumentError.new("Missing the required parameter 'underscore_type' when calling FakeApi.get_parameter_name_mapping") - end - # verify the required parameter "_type" is set - if @api_client.config.client_side_validation && _type.nil? - raise ArgumentError.new("Missing the required parameter '_type' when calling FakeApi.get_parameter_name_mapping") - end - # verify the required parameter "type_with_underscore" is set - if @api_client.config.client_side_validation && type_with_underscore.nil? - raise ArgumentError.new("Missing the required parameter 'type_with_underscore' when calling FakeApi.get_parameter_name_mapping") - end - # verify the required parameter "type_with_dash" is set - if @api_client.config.client_side_validation && type_with_dash.nil? - raise ArgumentError.new("Missing the required parameter 'type_with_dash' when calling FakeApi.get_parameter_name_mapping") - end - # verify the required parameter "http_debug_option" is set - if @api_client.config.client_side_validation && http_debug_option.nil? - raise ArgumentError.new("Missing the required parameter 'http_debug_option' when calling FakeApi.get_parameter_name_mapping") - end - # resource path - local_var_path = "/fake/parameter-name-mapping" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - query_params["type"] = _type.to_s unless _type.nil? - query_params["http_debug_option"] = http_debug_option.to_s unless http_debug_option.nil? - - # header parameters - header_params = Hash(String, String).new - header_params["_type"] = underscore_type - header_params["type_"] = type_with_underscore - header_params["type-"] = type_with_dash - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = [] of String - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"FakeApi.get_parameter_name_mapping", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: FakeApi#get_parameter_name_mapping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - end -end diff --git a/samples/client/petstore/crystal/src/petstore/api/fake_classname_test.cr b/samples/client/petstore/crystal/src/petstore/api/fake_classname_test.cr new file mode 100644 index 000000000000..3f83d8216f3d --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/fake_classname_test.cr @@ -0,0 +1,21 @@ +require "json" + +module Petstore + module Api + class FakeClassnameTest + def initialize(@conn : Connection); end + + # To test class name in snake case To test class name in snake case + def bulk_partial_update(model_client : Petstore::ModelClient) : Response(Petstore::ModelClient) + @conn.request(Petstore::ModelClient, + method: :PATCH, + path: "/fake_classname_test", + body: model_client, + accept: %w[application/json], + content_type: %w[application/json], + auth: %w[api_key_query]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/foo.cr b/samples/client/petstore/crystal/src/petstore/api/foo.cr new file mode 100644 index 000000000000..265777e7e92b --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/foo.cr @@ -0,0 +1,19 @@ +require "json" + +module Petstore + module Api + class Foo + def initialize(@conn : Connection); end + + # + def get() : Response(Petstore::FooGetDefaultResponse) + @conn.request(Petstore::FooGetDefaultResponse, + method: :GET, + path: "/foo", + accept: %w[application/json], + auth: %w[]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/pet.cr b/samples/client/petstore/crystal/src/petstore/api/pet.cr new file mode 100644 index 000000000000..5c1d29bcd830 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/pet.cr @@ -0,0 +1,92 @@ +require "json" + +module Petstore + module Api + class Pet + def initialize(@conn : Connection); end + + # Update an existing pet + def bulk_update(pet : Petstore::Pet) : Response(Nil) + @conn.request(Nil, + method: :PUT, + path: "/pet", + body: pet, + accept: %w[], + content_type: %w[application/json application/xml], + auth: %w[petstore_auth]) + end + + # Add a new pet to the store + def create(pet : Petstore::Pet) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/pet", + body: pet, + accept: %w[], + content_type: %w[application/json application/xml], + auth: %w[petstore_auth]) + end + + # Updates a pet in the store with form data + def create_post(pet_id : Int64, name : String? = nil, status : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/pet/{petId}".sub("{petId}", Petstore.enc(pet_id)), + form: Hash(String, Crest::ParamsValue){ "name" => name, "status" => status }, + accept: %w[], + auth: %w[petstore_auth]) + end + + # Deletes a pet + def delete(pet_id : Int64, *, api_key : String? = nil) : Response(Nil) + @conn.request(Nil, + method: :DELETE, + path: "/pet/{petId}".sub("{petId}", Petstore.enc(pet_id)), + header: { "api_key" => api_key.try &.to_s }, + accept: %w[], + auth: %w[petstore_auth]) + end + + # Finds Pets by status Multiple status values can be provided with comma separated strings + def find_by_status(*, status : Array(String)? = nil) : Response(Array(Petstore::Pet)) + @conn.request(Array(Petstore::Pet), + method: :GET, + path: "/pet/findByStatus", + query: { "status" => status.try(&.map(&.to_s).join(",")) }, + accept: %w[application/xml application/json], + auth: %w[petstore_auth]) + end + + # Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + @[Deprecated("This operation is marked deprecated in the OpenAPI spec.")] + def find_by_tags(*, tags : Set(String)? = nil) : Response(Set(Petstore::Pet)) + @conn.request(Set(Petstore::Pet), + method: :GET, + path: "/pet/findByTags", + query: { "tags" => tags.try(&.map(&.to_s).join(",")) }, + accept: %w[application/xml application/json], + auth: %w[petstore_auth]) + end + + # Find pet by ID Returns a single pet + def get(pet_id : Int64) : Response(Petstore::Pet) + @conn.request(Petstore::Pet, + method: :GET, + path: "/pet/{petId}".sub("{petId}", Petstore.enc(pet_id)), + accept: %w[application/xml application/json], + auth: %w[api_key]) + end + + # uploads an image + def upload_image(pet_id : Int64, additional_metadata : String? = nil, file : ::File? = nil) : Response(Petstore::ApiResponse) + @conn.request(Petstore::ApiResponse, + method: :POST, + path: "/pet/{petId}/uploadImage".sub("{petId}", Petstore.enc(pet_id)), + form: Hash(String, Crest::ParamsValue){ "additionalMetadata" => additional_metadata, "file" => file }, + accept: %w[application/json], + auth: %w[petstore_auth]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/pet_api.cr b/samples/client/petstore/crystal/src/petstore/api/pet_api.cr deleted file mode 100644 index 1987fdfa1b52..000000000000 --- a/samples/client/petstore/crystal/src/petstore/api/pet_api.cr +++ /dev/null @@ -1,535 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.24.0-SNAPSHOT -# - -require "uri" - -module Petstore - class PetApi - property api_client : ApiClient - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # Add a new pet to the store - # - # @param pet [Pet] Pet object that needs to be added to the store - # @return [Pet] - def add_pet(pet : Pet) - data, _status_code, _headers = add_pet_with_http_info(pet) - data - end - - # Add a new pet to the store - # - # @param pet [Pet] Pet object that needs to be added to the store - # @return [Array<(Pet, Integer, Hash)>] Pet data, response status code and response headers - def add_pet_with_http_info(pet : Pet) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.add_pet ..."} - end - # verify the required parameter "pet" is set - if @api_client.config.client_side_validation && pet.nil? - raise ArgumentError.new("Missing the required parameter 'pet' when calling PetApi.add_pet") - end - # resource path - local_var_path = "/pet" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json", "application/xml"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = pet.to_json - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"PetApi.add_pet", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#add_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Pet.from_json(data), status_code, headers - end - - # Deletes a pet - # - # @param pet_id [Int64] Pet id to delete - # @return [nil] - def delete_pet(pet_id : Int64, api_key : String? = nil) - delete_pet_with_http_info(pet_id, api_key) - nil - end - - # Deletes a pet - # - # @param pet_id [Int64] Pet id to delete - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def delete_pet_with_http_info(pet_id : Int64, api_key : String? = nil) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.delete_pet ..."} - end - # verify the required parameter "pet_id" is set - if @api_client.config.client_side_validation && pet_id.nil? - raise ArgumentError.new("Missing the required parameter 'pet_id' when calling PetApi.delete_pet") - end - # resource path - local_var_path = "/pet/{petId}".sub("{" + "petId" + "}", URI.encode_path(pet_id.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - header_params["api_key"] = api_key - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :DELETE, - path: local_var_path, - operation: :"PetApi.delete_pet", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Finds Pets by status - # Multiple status values can be provided with comma separated strings - # @param status [Array(String)] Status values that need to be considered for filter - # @return [Array(Pet)] - def find_pets_by_status(status : Array(String)) - data, _status_code, _headers = find_pets_by_status_with_http_info(status) - data - end - - # Finds Pets by status - # Multiple status values can be provided with comma separated strings - # @param status [Array(String)] Status values that need to be considered for filter - # @return [Array<(Array(Pet), Integer, Hash)>] Array(Pet) data, response status code and response headers - def find_pets_by_status_with_http_info(status : Array(String)) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.find_pets_by_status ..."} - end - # verify the required parameter "status" is set - if @api_client.config.client_side_validation && status.nil? - raise ArgumentError.new("Missing the required parameter 'status' when calling PetApi.find_pets_by_status") - end - # resource path - local_var_path = "/pet/findByStatus" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - query_params["status"] = @api_client.build_collection_param(status, :csv) unless status.nil? - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"PetApi.find_pets_by_status", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#find_pets_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Array(Pet).from_json(data), status_code, headers - end - - # Finds Pets by tags - # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - # @param tags [Array(String)] Tags to filter by - # @return [Array(Pet)] - def find_pets_by_tags(tags : Array(String)) - data, _status_code, _headers = find_pets_by_tags_with_http_info(tags) - data - end - - # Finds Pets by tags - # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - # @param tags [Array(String)] Tags to filter by - # @return [Array<(Array(Pet), Integer, Hash)>] Array(Pet) data, response status code and response headers - def find_pets_by_tags_with_http_info(tags : Array(String)) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.find_pets_by_tags ..."} - end - # verify the required parameter "tags" is set - if @api_client.config.client_side_validation && tags.nil? - raise ArgumentError.new("Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags") - end - # resource path - local_var_path = "/pet/findByTags" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - query_params["tags"] = @api_client.build_collection_param(tags, :csv) unless tags.nil? - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"PetApi.find_pets_by_tags", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#find_pets_by_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Array(Pet).from_json(data), status_code, headers - end - - # Find pet by ID - # Returns a single pet - # @param pet_id [Int64] ID of pet to return - # @return [Pet] - def get_pet_by_id(pet_id : Int64) - data, _status_code, _headers = get_pet_by_id_with_http_info(pet_id) - data - end - - # Find pet by ID - # Returns a single pet - # @param pet_id [Int64] ID of pet to return - # @return [Array<(Pet, Integer, Hash)>] Pet data, response status code and response headers - def get_pet_by_id_with_http_info(pet_id : Int64) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.get_pet_by_id ..."} - end - # verify the required parameter "pet_id" is set - if @api_client.config.client_side_validation && pet_id.nil? - raise ArgumentError.new("Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id") - end - # resource path - local_var_path = "/pet/{petId}".sub("{" + "petId" + "}", URI.encode_path(pet_id.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"PetApi.get_pet_by_id", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#get_pet_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Pet.from_json(data), status_code, headers - end - - # Update an existing pet - # - # @param pet [Pet] Pet object that needs to be added to the store - # @return [Pet] - def update_pet(pet : Pet) - data, _status_code, _headers = update_pet_with_http_info(pet) - data - end - - # Update an existing pet - # - # @param pet [Pet] Pet object that needs to be added to the store - # @return [Array<(Pet, Integer, Hash)>] Pet data, response status code and response headers - def update_pet_with_http_info(pet : Pet) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.update_pet ..."} - end - # verify the required parameter "pet" is set - if @api_client.config.client_side_validation && pet.nil? - raise ArgumentError.new("Missing the required parameter 'pet' when calling PetApi.update_pet") - end - # resource path - local_var_path = "/pet" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json", "application/xml"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = pet.to_json - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :PUT, - path: local_var_path, - operation: :"PetApi.update_pet", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Pet.from_json(data), status_code, headers - end - - # Updates a pet in the store with form data - # - # @param pet_id [Int64] ID of pet that needs to be updated - # @return [nil] - def update_pet_with_form(pet_id : Int64, name : String? = nil, status : String? = nil) - update_pet_with_form_with_http_info(pet_id, name, status) - nil - end - - # Updates a pet in the store with form data - # - # @param pet_id [Int64] ID of pet that needs to be updated - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def update_pet_with_form_with_http_info(pet_id : Int64, name : String? = nil, status : String? = nil) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.update_pet_with_form ..."} - end - # verify the required parameter "pet_id" is set - if @api_client.config.client_side_validation && pet_id.nil? - raise ArgumentError.new("Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form") - end - # resource path - local_var_path = "/pet/{petId}".sub("{" + "petId" + "}", URI.encode_path(pet_id.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/x-www-form-urlencoded"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - form_params[:"name"] = name unless name.nil? - form_params[:"status"] = status unless status.nil? - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"PetApi.update_pet_with_form", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # uploads an image - # - # @param pet_id [Int64] ID of pet to update - # @return [ApiResponse] - def upload_file(pet_id : Int64, additional_metadata : String? = nil, file : ::File? = nil) - data, _status_code, _headers = upload_file_with_http_info(pet_id, additional_metadata, file) - data - end - - # uploads an image - # - # @param pet_id [Int64] ID of pet to update - # @return [Array<(ApiResponse, Integer, Hash)>] ApiResponse data, response status code and response headers - def upload_file_with_http_info(pet_id : Int64, additional_metadata : String? = nil, file : ::File? = nil) - if @api_client.config.debugging - Log.debug {"Calling API: PetApi.upload_file ..."} - end - # verify the required parameter "pet_id" is set - if @api_client.config.client_side_validation && pet_id.nil? - raise ArgumentError.new("Missing the required parameter 'pet_id' when calling PetApi.upload_file") - end - # resource path - local_var_path = "/pet/{petId}/uploadImage".sub("{" + "petId" + "}", URI.encode_path(pet_id.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/json"]) - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["multipart/form-data"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - form_params[:"additionalMetadata"] = additional_metadata unless additional_metadata.nil? - form_params[:"file"] = file unless file.nil? - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["petstore_auth"] - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"PetApi.upload_file", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return ApiResponse.from_json(data), status_code, headers - end - end -end diff --git a/samples/client/petstore/crystal/src/petstore/api/store.cr b/samples/client/petstore/crystal/src/petstore/api/store.cr new file mode 100644 index 000000000000..1623dd710cb3 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/store.cr @@ -0,0 +1,19 @@ +require "json" + +module Petstore + module Api + class Store + def initialize(@conn : Connection); end + + # Returns pet inventories by status Returns a map of status codes to quantities + def inventory() : Response(Hash(String, Int32)) + @conn.request(Hash(String, Int32), + method: :GET, + path: "/store/inventory", + accept: %w[application/json], + auth: %w[api_key]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/store/order.cr b/samples/client/petstore/crystal/src/petstore/api/store/order.cr new file mode 100644 index 000000000000..35052e4e022c --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/store/order.cr @@ -0,0 +1,39 @@ +require "json" + +module Petstore + module Api + class Store::Order + def initialize(@conn : Connection); end + + # Place an order for a pet + def create(order : Petstore::Order) : Response(Petstore::Order) + @conn.request(Petstore::Order, + method: :POST, + path: "/store/order", + body: order, + accept: %w[application/xml application/json], + content_type: %w[application/json], + auth: %w[]) + end + + # Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + def delete(order_id : String) : Response(Nil) + @conn.request(Nil, + method: :DELETE, + path: "/store/order/{order_id}".sub("{order_id}", Petstore.enc(order_id)), + accept: %w[], + auth: %w[]) + end + + # Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + def get(order_id : Int64) : Response(Petstore::Order) + @conn.request(Petstore::Order, + method: :GET, + path: "/store/order/{order_id}".sub("{order_id}", Petstore.enc(order_id)), + accept: %w[application/xml application/json], + auth: %w[]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/store_api.cr b/samples/client/petstore/crystal/src/petstore/api/store_api.cr deleted file mode 100644 index 7bae60a6ca56..000000000000 --- a/samples/client/petstore/crystal/src/petstore/api/store_api.cr +++ /dev/null @@ -1,274 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.24.0-SNAPSHOT -# - -require "uri" - -module Petstore - class StoreApi - property api_client : ApiClient - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # Delete purchase order by ID - # For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - # @param order_id [String] ID of the order that needs to be deleted - # @return [nil] - def delete_order(order_id : String) - delete_order_with_http_info(order_id) - nil - end - - # Delete purchase order by ID - # For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - # @param order_id [String] ID of the order that needs to be deleted - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def delete_order_with_http_info(order_id : String) - if @api_client.config.debugging - Log.debug {"Calling API: StoreApi.delete_order ..."} - end - # verify the required parameter "order_id" is set - if @api_client.config.client_side_validation && order_id.nil? - raise ArgumentError.new("Missing the required parameter 'order_id' when calling StoreApi.delete_order") - end - # resource path - local_var_path = "/store/order/{orderId}".sub("{" + "orderId" + "}", URI.encode_path(order_id.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = [] of String - - data, status_code, headers = @api_client.call_api( - http_method: :DELETE, - path: local_var_path, - operation: :"StoreApi.delete_order", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Returns pet inventories by status - # Returns a map of status codes to quantities - # @return [Hash(String, Int32)] - def get_inventory() - data, _status_code, _headers = get_inventory_with_http_info() - data - end - - # Returns pet inventories by status - # Returns a map of status codes to quantities - # @return [Array<(Hash(String, Int32), Integer, Hash)>] Hash(String, Int32) data, response status code and response headers - def get_inventory_with_http_info() - if @api_client.config.debugging - Log.debug {"Calling API: StoreApi.get_inventory ..."} - end - # resource path - local_var_path = "/store/inventory" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"StoreApi.get_inventory", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: StoreApi#get_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Hash(String, Int32).from_json(data), status_code, headers - end - - # Find purchase order by ID - # For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - # @param order_id [Int64] ID of pet that needs to be fetched - # @return [Order] - def get_order_by_id(order_id : Int64) - data, _status_code, _headers = get_order_by_id_with_http_info(order_id) - data - end - - # Find purchase order by ID - # For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - # @param order_id [Int64] ID of pet that needs to be fetched - # @return [Array<(Order, Integer, Hash)>] Order data, response status code and response headers - def get_order_by_id_with_http_info(order_id : Int64) - if @api_client.config.debugging - Log.debug {"Calling API: StoreApi.get_order_by_id ..."} - end - # verify the required parameter "order_id" is set - if @api_client.config.client_side_validation && order_id.nil? - raise ArgumentError.new("Missing the required parameter 'order_id' when calling StoreApi.get_order_by_id") - end - if @api_client.config.client_side_validation && order_id > 5 - raise ArgumentError.new("invalid value for \"order_id\" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.") - end - - if @api_client.config.client_side_validation && order_id < 1 - raise ArgumentError.new("invalid value for \"order_id\" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.") - end - - # resource path - local_var_path = "/store/order/{orderId}".sub("{" + "orderId" + "}", URI.encode_path(order_id.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = [] of String - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"StoreApi.get_order_by_id", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: StoreApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Order.from_json(data), status_code, headers - end - - # Place an order for a pet - # - # @param order [Order] order placed for purchasing the pet - # @return [Order] - def place_order(order : Order) - data, _status_code, _headers = place_order_with_http_info(order) - data - end - - # Place an order for a pet - # - # @param order [Order] order placed for purchasing the pet - # @return [Array<(Order, Integer, Hash)>] Order data, response status code and response headers - def place_order_with_http_info(order : Order) - if @api_client.config.debugging - Log.debug {"Calling API: StoreApi.place_order ..."} - end - # verify the required parameter "order" is set - if @api_client.config.client_side_validation && order.nil? - raise ArgumentError.new("Missing the required parameter 'order' when calling StoreApi.place_order") - end - # resource path - local_var_path = "/store/order" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = order.to_json - - # auth_names - auth_names = [] of String - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"StoreApi.place_order", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return Order.from_json(data), status_code, headers - end - end -end diff --git a/samples/client/petstore/crystal/src/petstore/api/user.cr b/samples/client/petstore/crystal/src/petstore/api/user.cr new file mode 100644 index 000000000000..1b5eb7e4bcb3 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/api/user.cr @@ -0,0 +1,91 @@ +require "json" + +module Petstore + module Api + class User + def initialize(@conn : Connection); end + + # Create user This can only be done by the logged in user. + def create(user : Petstore::User) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/user", + body: user, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # Creates list of users with given input array + def create_with_array(user : Array(Petstore::User)) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/user/createWithArray", + body: user, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # Creates list of users with given input array + def create_with_list(user : Array(Petstore::User)) : Response(Nil) + @conn.request(Nil, + method: :POST, + path: "/user/createWithList", + body: user, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + + # Delete user This can only be done by the logged in user. + def delete(username : String) : Response(Nil) + @conn.request(Nil, + method: :DELETE, + path: "/user/{username}".sub("{username}", Petstore.enc(username)), + accept: %w[], + auth: %w[]) + end + + # Get user by user name + def get(username : String) : Response(Petstore::User) + @conn.request(Petstore::User, + method: :GET, + path: "/user/{username}".sub("{username}", Petstore.enc(username)), + accept: %w[application/xml application/json], + auth: %w[]) + end + + # Logs user into the system + def login(*, username : String? = nil, password : String? = nil) : Response(String) + @conn.request(String, + method: :GET, + path: "/user/login", + query: { "username" => username, "password" => password }, + accept: %w[application/xml application/json], + auth: %w[]) + end + + # Logs out current logged in user session + def logout() : Response(Nil) + @conn.request(Nil, + method: :GET, + path: "/user/logout", + accept: %w[], + auth: %w[]) + end + + # Updated user This can only be done by the logged in user. + def update(username : String, user : Petstore::User) : Response(Nil) + @conn.request(Nil, + method: :PUT, + path: "/user/{username}".sub("{username}", Petstore.enc(username)), + body: user, + accept: %w[], + content_type: %w[application/json], + auth: %w[]) + end + end + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/api/user_api.cr b/samples/client/petstore/crystal/src/petstore/api/user_api.cr deleted file mode 100644 index a7c7e0031be0..000000000000 --- a/samples/client/petstore/crystal/src/petstore/api/user_api.cr +++ /dev/null @@ -1,533 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.24.0-SNAPSHOT -# - -require "uri" - -module Petstore - class UserApi - property api_client : ApiClient - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # Create user - # This can only be done by the logged in user. - # @param user [User] Created user object - # @return [nil] - def create_user(user : User) - create_user_with_http_info(user) - nil - end - - # Create user - # This can only be done by the logged in user. - # @param user [User] Created user object - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def create_user_with_http_info(user : User) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.create_user ..."} - end - # verify the required parameter "user" is set - if @api_client.config.client_side_validation && user.nil? - raise ArgumentError.new("Missing the required parameter 'user' when calling UserApi.create_user") - end - # resource path - local_var_path = "/user" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = user.to_json - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"UserApi.create_user", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Creates list of users with given input array - # - # @param user [Array(User)] List of user object - # @return [nil] - def create_users_with_array_input(user : Array(User)) - create_users_with_array_input_with_http_info(user) - nil - end - - # Creates list of users with given input array - # - # @param user [Array(User)] List of user object - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def create_users_with_array_input_with_http_info(user : Array(User)) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.create_users_with_array_input ..."} - end - # verify the required parameter "user" is set - if @api_client.config.client_side_validation && user.nil? - raise ArgumentError.new("Missing the required parameter 'user' when calling UserApi.create_users_with_array_input") - end - # resource path - local_var_path = "/user/createWithArray" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = user.to_json - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"UserApi.create_users_with_array_input", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#create_users_with_array_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Creates list of users with given input array - # - # @param user [Array(User)] List of user object - # @return [nil] - def create_users_with_list_input(user : Array(User)) - create_users_with_list_input_with_http_info(user) - nil - end - - # Creates list of users with given input array - # - # @param user [Array(User)] List of user object - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def create_users_with_list_input_with_http_info(user : Array(User)) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.create_users_with_list_input ..."} - end - # verify the required parameter "user" is set - if @api_client.config.client_side_validation && user.nil? - raise ArgumentError.new("Missing the required parameter 'user' when calling UserApi.create_users_with_list_input") - end - # resource path - local_var_path = "/user/createWithList" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = user.to_json - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :POST, - path: local_var_path, - operation: :"UserApi.create_users_with_list_input", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#create_users_with_list_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Delete user - # This can only be done by the logged in user. - # @param username [String] The name that needs to be deleted - # @return [nil] - def delete_user(username : String) - delete_user_with_http_info(username) - nil - end - - # Delete user - # This can only be done by the logged in user. - # @param username [String] The name that needs to be deleted - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def delete_user_with_http_info(username : String) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.delete_user ..."} - end - # verify the required parameter "username" is set - if @api_client.config.client_side_validation && username.nil? - raise ArgumentError.new("Missing the required parameter 'username' when calling UserApi.delete_user") - end - # resource path - local_var_path = "/user/{username}".sub("{" + "username" + "}", URI.encode_path(username.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :DELETE, - path: local_var_path, - operation: :"UserApi.delete_user", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Get user by user name - # - # @param username [String] The name that needs to be fetched. Use user1 for testing. - # @return [User] - def get_user_by_name(username : String) - data, _status_code, _headers = get_user_by_name_with_http_info(username) - data - end - - # Get user by user name - # - # @param username [String] The name that needs to be fetched. Use user1 for testing. - # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers - def get_user_by_name_with_http_info(username : String) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.get_user_by_name ..."} - end - # verify the required parameter "username" is set - if @api_client.config.client_side_validation && username.nil? - raise ArgumentError.new("Missing the required parameter 'username' when calling UserApi.get_user_by_name") - end - # resource path - local_var_path = "/user/{username}".sub("{" + "username" + "}", URI.encode_path(username.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = [] of String - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"UserApi.get_user_by_name", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return User.from_json(data), status_code, headers - end - - # Logs user into the system - # - # @param username [String] The user name for login - # @param password [String] The password for login in clear text - # @return [String] - def login_user(username : String, password : String) - data, _status_code, _headers = login_user_with_http_info(username, password) - data - end - - # Logs user into the system - # - # @param username [String] The user name for login - # @param password [String] The password for login in clear text - # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers - def login_user_with_http_info(username : String, password : String) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.login_user ..."} - end - # verify the required parameter "username" is set - if @api_client.config.client_side_validation && username.nil? - raise ArgumentError.new("Missing the required parameter 'username' when calling UserApi.login_user") - end - pattern = Regexp.new(/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/) - if @api_client.config.client_side_validation && username !~ pattern - raise ArgumentError.new("invalid value for \"username\" when calling UserApi.login_user, must conform to the pattern #{pattern}.") - end - - # verify the required parameter "password" is set - if @api_client.config.client_side_validation && password.nil? - raise ArgumentError.new("Missing the required parameter 'password' when calling UserApi.login_user") - end - # resource path - local_var_path = "/user/login" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - query_params["username"] = username.to_s unless username.nil? - query_params["password"] = password.to_s unless password.nil? - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Accept" (if needed) - header_params["Accept"] = @api_client.select_header_accept(["application/xml", "application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = [] of String - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"UserApi.login_user", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#login_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return String.from_json(data), status_code, headers - end - - # Logs out current logged in user session - # - # @return [nil] - def logout_user() - logout_user_with_http_info() - nil - end - - # Logs out current logged in user session - # - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def logout_user_with_http_info() - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.logout_user ..."} - end - # resource path - local_var_path = "/user/logout" - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = nil - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :GET, - path: local_var_path, - operation: :"UserApi.logout_user", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#logout_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - - # Updated user - # This can only be done by the logged in user. - # @param username [String] name that need to be deleted - # @param user [User] Updated user object - # @return [nil] - def update_user(username : String, user : User) - update_user_with_http_info(username, user) - nil - end - - # Updated user - # This can only be done by the logged in user. - # @param username [String] name that need to be deleted - # @param user [User] Updated user object - # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def update_user_with_http_info(username : String, user : User) - if @api_client.config.debugging - Log.debug {"Calling API: UserApi.update_user ..."} - end - # verify the required parameter "username" is set - if @api_client.config.client_side_validation && username.nil? - raise ArgumentError.new("Missing the required parameter 'username' when calling UserApi.update_user") - end - # verify the required parameter "user" is set - if @api_client.config.client_side_validation && user.nil? - raise ArgumentError.new("Missing the required parameter 'user' when calling UserApi.update_user") - end - # resource path - local_var_path = "/user/{username}".sub("{" + "username" + "}", URI.encode_path(username.to_s).gsub("%2F", "/")) - - # cookie parameters - cookie_params = Hash(String, String).new - - # query parameters - query_params = Hash(String, String | Array(String)).new - - # header parameters - header_params = Hash(String, String).new - # HTTP header "Content-Type" - header_params["Content-Type"] = @api_client.select_header_content_type(["application/json"]) - - # form parameters - form_params = Hash(Symbol, (String | ::File)).new - - # http body (model) - post_body = user.to_json - - # auth_names - auth_names = ["api_key"] - - data, status_code, headers = @api_client.call_api( - http_method: :PUT, - path: local_var_path, - operation: :"UserApi.update_user", - post_body: post_body, - auth_names: auth_names, - header_params: header_params, - query_params: query_params, - cookie_params: cookie_params, - form_params: form_params - ) - - if @api_client.config.debugging - Log.debug {"API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"} - end - - return nil, status_code, headers - end - end -end diff --git a/samples/client/petstore/crystal/src/petstore/api_client.cr b/samples/client/petstore/crystal/src/petstore/api_client.cr deleted file mode 100644 index 5143482ada80..000000000000 --- a/samples/client/petstore/crystal/src/petstore/api_client.cr +++ /dev/null @@ -1,183 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.24.0-SNAPSHOT -# - -require "json" -require "time" - -module Petstore - class ApiClient - # The Configuration object holding settings to be used in the API client. - property config : Configuration - - # Defines the headers to be used in HTTP requests of all API calls by default. - # - # @return [Hash] - property default_headers : Hash(String, String) - - # Initializes the ApiClient - # @option config [Configuration] Configuration for initializing the object, default to Configuration.default - def initialize(@config = Configuration.default) - @user_agent = "OpenAPI-Generator/#{VERSION}/crystal" - @default_headers = { - "User-Agent" => @user_agent - } - end - - def self.default - @@default ||= ApiClient.new - end - - # Check if the given MIME is a JSON MIME. - # JSON MIME examples: - # application/json - # application/json; charset=UTF8 - # APPLICATION/JSON - # */* - # @param [String] mime MIME - # @return [Boolean] True if the MIME is application/json - def json_mime?(mime) - (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? - end - - - def build_request_url(path : String, operation : Symbol) - # Add leading and trailing slashes to path - path = "/#{path}".gsub(/\/+/, "/") - @config.base_url(operation) + path - end - - # Update header and query params based on authentication settings. - # - # @param [Hash] header_params Header parameters - # @param [Hash] query_params Query parameters - # @param [String] auth_names Authentication scheme name - def update_params_for_auth!(header_params, query_params, cookie_params, auth_names) - auth_names.each do |auth_name| - auth_setting = @config.auth_settings[auth_name] - next unless auth_setting - case auth_setting[:in] - when "header" then header_params[auth_setting[:key]] = auth_setting[:value] - when "query" then query_params[auth_setting[:key]] = auth_setting[:value] - when "cookie" then cookie_params[auth_setting[:key]] = auth_setting[:value] - else raise ArgumentError.new("Authentication token must be in `cookie`, `query` or `header`") - end - end - end - - # Sets user agent in HTTP header - # - # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) - def user_agent=(user_agent) - @user_agent = user_agent - @default_headers["User-Agent"] = @user_agent - end - - # Return Accept header based on an array of accepts provided. - # @param [Array] accepts array for Accept - # @return [String] the Accept header (e.g. application/json) - def select_header_accept(accepts) : String - #return nil if accepts.nil? || accepts.empty? - # use JSON when present, otherwise use all of the provided - json_accept = accepts.find { |s| json_mime?(s) } - if json_accept.nil? - accepts.join(",") - else - json_accept - end - end - - # Return Content-Type header based on an array of content types provided. - # @param [Array] content_types array for Content-Type - # @return [String] the Content-Type header (e.g. application/json) - def select_header_content_type(content_types) - # use application/json by default - return "application/json" if content_types.nil? || content_types.empty? - # use JSON when present, otherwise use the first one - json_content_type = content_types.find { |s| json_mime?(s) } - json_content_type || content_types.first - end - - # Build parameter value according to the given collection format. - # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi - def build_collection_param(param, collection_format) - case collection_format - when :csv - param.join(",") - when :ssv - param.join(" ") - when :tsv - param.join("\t") - when :pipes - param.join("|") - when :multi - param - else - raise "unknown collection format: #{collection_format.inspect}" - end - end - - # Call an API with given options. - # - # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: - # the data deserialized from response body (could be nil), response status code and response headers. - def call_api(http_method : Symbol, path : String, operation : Symbol, post_body : String?, auth_names = [] of String, header_params = {} of String => String, query_params = {} of String => String, cookie_params = {} of String => String, form_params = {} of Symbol => (String | ::File)) - #ssl_options = { - # :ca_file => @config.ssl_ca_file, - # :verify => @config.ssl_verify, - # :verify_mode => @config.ssl_verify_mode, - # :client_cert => @config.ssl_client_cert, - # :client_key => @config.ssl_client_key - #} - - update_params_for_auth! header_params, query_params, cookie_params, auth_names - - if !post_body.nil? && !post_body.empty? - # use JSON string in the payload - form_or_body = post_body - else - # use HTTP forms in the payload - # TODO use HTTP form encoding - form_or_body = form_params - end - - request = Crest::Request.new( - method: http_method, - url: build_request_url(path, operation), - params: query_params, - headers: header_params, - cookies: cookie_params, - form: form_or_body, - logging: @config.debugging, - handle_errors: false, - params_encoder: Crest::NestedParamsEncoder - ) - - response = request.execute - - if @config.debugging - Log.debug {"HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"} - end - - if !response.success? - if response.status == 0 - # Errors from libcurl will be made visible here - raise ApiError.new(code: 0, - message: response.body) - else - raise ApiError.new(code: response.status_code, - response_headers: response.headers, - message: response.body) - end - end - - return response.body, response.status_code, response.headers - end - end -end diff --git a/samples/client/petstore/crystal/src/petstore/api_error.cr b/samples/client/petstore/crystal/src/petstore/api_error.cr index cac165a27b4c..1ecb290de700 100644 --- a/samples/client/petstore/crystal/src/petstore/api_error.cr +++ b/samples/client/petstore/crystal/src/petstore/api_error.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -11,31 +9,44 @@ module Petstore class ApiError < Exception getter code : Int32? - getter response_headers : Hash(String, Array(String) | String)? + getter response_headers : HTTP::Headers? # Usage examples: # ApiError.new # ApiError.new(message: "message") - # ApiError.new(code: 500, response_headers: {}, message: "") + # ApiError.new(code: 500, response_headers: HTTP::Headers.new, message: "") # ApiError.new(code: 404, message: "Not Found") - def initialize(@code , @message, @response_headers) + def initialize(@code : Int32?, @response_headers : HTTP::Headers?, message : String?) + super(message) + end + + def initialize(@code : Int32?, @response_headers : HTTP::Headers?, body : String) + msg = body.empty? ? "the server returns an error but the HTTP response body is empty." : body + super(msg) + @message = msg end - def initialize(@code , @message) + def initialize(message : String) + super(message) + @code = nil + @response_headers = nil + end + + def initialize + super(nil) + @code = nil + @response_headers = nil end # Override to_s to display a friendly error message - def to_s - msg = "" - msg = msg + "\nHTTP status code: #{code}" if @code - msg = msg + "\nResponse headers: #{response_headers}" if @response_headers - if @message.try &.empty? - msg = msg + "\nError message: the server returns an error but the HTTP response body is empty." + def to_s(io : IO) : Nil + io << "\nHTTP status code: #{code}" if @code + io << "\nResponse headers: #{response_headers}" if @response_headers + if message.nil? || message.try &.empty? + io << "\nError message: the server returns an error but the HTTP response body is empty." else - msg = msg + "\nResponse body: #{@message}" + io << "\nResponse body: #{message}" end - - msg end end end diff --git a/samples/client/petstore/crystal/src/petstore/client.cr b/samples/client/petstore/crystal/src/petstore/client.cr new file mode 100644 index 000000000000..5d236be32b59 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/client.cr @@ -0,0 +1,92 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class Client + getter connection : Connection + + def initialize(*, host : String, token : String? = nil, scheme : String = "https") + cfg = Configuration.new + cfg.host = host + cfg.scheme = scheme + cfg.access_token = token if token + @connection = Connection.new(cfg) + end + + def initialize(@connection : Connection); end + def another_fake : Api::AnotherFake + @another_fake ||= Api::AnotherFake.new(@connection) + end + + @another_fake : Api::AnotherFake? + def fake : Api::Fake + @fake ||= Api::Fake.new(@connection) + end + + @fake : Api::Fake? + def fake_classname_test : Api::FakeClassnameTest + @fake_classname_test ||= Api::FakeClassnameTest.new(@connection) + end + + @fake_classname_test : Api::FakeClassnameTest? + def foo : Api::Foo + @foo ||= Api::Foo.new(@connection) + end + + @foo : Api::Foo? + def pet : Api::Pet + @pet ||= Api::Pet.new(@connection) + end + + @pet : Api::Pet? + def store : Api::Store + @store ||= Api::Store.new(@connection) + end + + @store : Api::Store? + def user : Api::User + @user ||= Api::User.new(@connection) + end + + @user : Api::User? + end + + class Api::AnotherFake + def initialize(@conn : Connection); end + end + + class Api::Fake + def initialize(@conn : Connection); end + end + + class Api::FakeClassnameTest + def initialize(@conn : Connection); end + end + + class Api::Foo + def initialize(@conn : Connection); end + end + + class Api::Pet + def initialize(@conn : Connection); end + end + + class Api::Store + def initialize(@conn : Connection); end + + def order : Api::Store::Order + @order ||= Api::Store::Order.new(@conn) + end + + @order : Api::Store::Order? + end + + class Api::User + def initialize(@conn : Connection); end + end +end diff --git a/samples/client/petstore/crystal/src/petstore/configuration.cr b/samples/client/petstore/crystal/src/petstore/configuration.cr index e9fe8945c3ec..9035de32ab0b 100644 --- a/samples/client/petstore/crystal/src/petstore/configuration.cr +++ b/samples/client/petstore/crystal/src/petstore/configuration.cr @@ -1,13 +1,14 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech #Generator version: 7.24.0-SNAPSHOT # +require "base64" +require "crest" +require "http" require "log" module Petstore @@ -21,18 +22,6 @@ module Petstore # Defines url base path property base_path : String - # Define server configuration index - property server_index : Int32 - - # Define server operation configuration index - property server_operation_index : Hash(Symbol, String) - - # Default server variables - property server_variables : Hash(Symbol, String) - - # Default server operation variables - property server_operation_variables : Hash(Symbol, String) - # Defines API keys used with API Key authentications. # # @return [Hash] key: parameter name, value: parameter value (API key) @@ -69,6 +58,15 @@ module Petstore # @return [true, false] property debugging : Bool + # Enable the underlying HTTP client's (crest) request/response logging. Off by default, so the + # shard produces no log output unless a consumer opts in (e.g. a higher-level client wrapper + # can expose `config.logging = true`). Independent of `debugging`. + property logging : Bool + + # Logger used by crest when `logging` is enabled. Defaults to `Crest::CommonLogger`; assign a + # custom `Crest::Logger` to control formatting/output. + property logger : Crest::Logger + # Defines the temporary folder to store downloaded files # (for API endpoints that have file response). # Default to use `Tempfile`. @@ -127,25 +125,28 @@ module Petstore # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 #property params_encoding : String? + # Default headers sent with every request. + property default_headers : HTTP::Headers = HTTP::Headers.new + + # Params encoder used to encode array query parameters. + # Default: Crest::NestedParamsEncoder (encodes arrays as key=a&key=b). + property params_encoder : Crest::ParamsEncoder.class = Crest::NestedParamsEncoder + # Create a new `Configuration`. def initialize @scheme = "http" - @host = "localhost" + @host = "petstore.swagger.io" @base_path = "/v2" - @server_index = 0 - @server_operation_index = {} of Symbol => String - @server_variables = {} of Symbol => String - @server_operation_variables = {} of Symbol => String @api_key = {} of Symbol => String @api_key_prefix = {} of Symbol => String @timeout = 0 @client_side_validation = true - @verify_ssl = true - @verify_ssl_host = true #@params_encoding = nil #@cert_file = nil #@key_file = nil @debugging = false + @logging = false + @logger = Crest::CommonLogger.new @username = nil @password = nil @access_token = nil @@ -191,13 +192,9 @@ module Petstore @base_path = "" if @base_path == "/" end - # Returns base URL for specified operation based on server settings - def base_url(operation = Nil) - # TODO revise below to support operation-level server setting - #index = server_operation_index.fetch(operation, server_index) - return "#{scheme}://#{[host, base_path].join("/").gsub(/\/+/, "/")}".sub(/\/+\z/, "") #if index == Nil - - #server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + # Returns the base URL for requests. + def base_url + "#{scheme}://#{[host, base_path].join("/").gsub(/\/+/, "/")}".sub(/\/+\z/, "") end # Gets API key (with prefix if set). @@ -212,72 +209,40 @@ module Petstore # Gets Basic Auth token string def basic_auth_token - "Basic " + ["#{username}:#{password}"].pack("m").delete("\r\n") - end - - # Returns Auth Settings hash for api client. - def auth_settings - Hash{ - "petstore_auth" => { - type: "oauth2", - in: "header", - key: "Authorization", - value: "Bearer #{access_token}" - }, - "api_key" => { - type: "api_key", - in: "header", - key: "api_key", - value: api_key_with_prefix(:api_key) - }, - } - end - - # Returns an array of Server setting - def server_settings - [ - { - url: "http://localhost/v2", - description: "No description provided", - } - ] + "Basic " + Base64.strict_encode("#{username}:#{password}") end - def operation_server_settings - end - - # Returns URL based on server settings - # - # @param index array index of the server settings - # @param variables hash of variable and the corresponding value - def server_url(index, variables = {} of Symbol => String, servers = Nil) - servers = server_settings if servers == Nil - - # check array index out of bound - if (index < 0 || index >= servers.size) - raise ArgumentError.new("Invalid index #{index} when selecting the server. Must be less than #{servers.size}") + # Applies authentication credentials to request headers and query params. + # Called by Connection#request for every outgoing request. + def apply_auth!(headers : HTTP::Headers, params : Hash(String, String | Array(String)), auth_names : Array(String)) : Nil + if auth_names.includes?("petstore_auth") + if token = @access_token + headers["Authorization"] = "Bearer #{token}" + end end - - server = servers[index] - url = server[:url] - - return url unless server.has_key? :variables - - # go through variable and assign a value - server[:variables].each do |name, variable| - if variables.has_key?(name) - if (!server[:variables][name].has_key?(:enum_values) || server[:variables][name][:enum_values].includes?(variables[name])) - url.gsub! "{" + name.to_s + "}", variables[name] - else - raise ArgumentError.new("The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}.") - end - else - # use default value - url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + if auth_names.includes?("api_key") + value = api_key_with_prefix(:"api_key") + unless value.empty? + headers["api_key"] = value + end + end + if auth_names.includes?("api_key_query") + value = api_key_with_prefix(:"api_key_query") + unless value.empty? + params["api_key_query"] = value + end + end + if auth_names.includes?("http_basic_test") + if @username || @password + headers["Authorization"] = basic_auth_token + end + end + if auth_names.includes?("bearer_test") + if token = @access_token + headers["Authorization"] = "Bearer #{token}" end end - - url end + end end diff --git a/samples/client/petstore/crystal/src/petstore/connection.cr b/samples/client/petstore/crystal/src/petstore/connection.cr new file mode 100644 index 000000000000..6bd9d6a84b80 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/connection.cr @@ -0,0 +1,96 @@ +require "crest" +require "json" +require "log" +require "uri" + +module Petstore + Log = ::Log.for("petstore") + + def self.enc(value) : String + URI.encode_path_segment(value.to_s) + end + + class Connection + getter config : Configuration + + def initialize(@config : Configuration); end + + def request(klass : T.class, *, method : Symbol, path : String, + body = nil, query : Hash(String, _)? = nil, + form : Hash(String, Crest::ParamsValue)? = nil, + header : Hash(String, String?)? = nil, + accept : Array(String) = %w[application/json], + content_type : Array(String) = %w[application/json], + auth : Array(String) = %w[], + raw : Bool = false) : Response(T) forall T + Log.debug { "#{method} #{path}" } if config.debugging + + headers = config.default_headers.dup + header.try &.each { |k, v| headers[k] = v unless v.nil? } + # Prefer a JSON media type when the operation offers one: the body is always + # JSON-decoded (T.from_json), so requesting application/xml first (as some specs + # list it) would yield a response we can't parse. + headers["Accept"] = (accept.find(&.includes?("json")) || accept.first) unless accept.empty? + q = {} of String => String | Array(String) + query.try &.each do |k, v| + next if v.nil? + case v + when Array then q[k] = v.map(&.to_s) + else q[k] = v.to_s + end + end + config.apply_auth!(headers, q, auth) + + # Determine what to pass as the form/body argument to Crest + # If there's a JSON body, serialize it and pass as raw string form + body_str : String? = body.nil? ? nil : body.to_json + headers["Content-Type"] = content_type.first if body_str && !content_type.empty? + + crest_form : Hash(String, Crest::ParamsValue) | String | Nil = + if body_str + body_str + elsif form && !form.empty? + form + else + nil + end + + headers_hash = {} of String => String | Array(String) + headers.each { |k, vs| headers_hash[k] = vs.size == 1 ? vs.first : vs } + + resp = Crest::Request.execute( + method, + config.base_url + path, + crest_form, + headers: headers_hash, + params: q, + params_encoder: config.params_encoder, + logging: config.logging, + logger: config.logger, + handle_errors: false) + + resp_headers = to_http_headers(resp.headers) + unless 200 <= resp.status_code < 300 + raise ApiError.new(resp.status_code, resp_headers, resp.body) + end + + # `raw` (set by operations whose response isn't JSON, e.g. text/plain or binary) returns the + # body untouched; a String return type is otherwise JSON-decoded (unquoted). + value = {% if T == Nil %} nil {% elsif T == String %} (raw ? resp.body : String.from_json(resp.body)) {% else %} T.from_json(resp.body) {% end %} + Response(T).new(value, resp.status_code, resp_headers) + end + + # Crest returns headers as a Hash whose values may be a String or an Array(String); + # convert to the idiomatic HTTP::Headers used by Response/ApiError. + private def to_http_headers(raw) : HTTP::Headers + headers = HTTP::Headers.new + raw.each do |key, value| + case value + when Array then value.each { |v| headers.add(key, v) } + else headers[key] = value.to_s + end + end + headers + end + end +end diff --git a/samples/client/petstore/crystal/src/petstore/models/additional_properties_class.cr b/samples/client/petstore/crystal/src/petstore/models/additional_properties_class.cr new file mode 100644 index 000000000000..075905bcd51c --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/additional_properties_class.cr @@ -0,0 +1,45 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class AdditionalPropertiesClass + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "map_property", emit_null: false)] + property map_property : Hash(String, String)? + + @[JSON::Field(key: "map_of_map_property", emit_null: false)] + property map_of_map_property : Hash(String, Hash(String, String))? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@map_property : Hash(String, String)? = nil, @map_of_map_property : Hash(String, Hash(String, String))? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(map_property, map_of_map_property) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/all_of_with_single_ref.cr b/samples/client/petstore/crystal/src/petstore/models/all_of_with_single_ref.cr new file mode 100644 index 000000000000..dba39c3a2775 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/all_of_with_single_ref.cr @@ -0,0 +1,45 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class AllOfWithSingleRef + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "username", emit_null: false)] + property username : String? + + @[JSON::Field(key: "SingleRefType", emit_null: false)] + property single_ref_type : SingleRefType? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@username : String? = nil, @single_ref_type : SingleRefType? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(username, single_ref_type) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/animal.cr b/samples/client/petstore/crystal/src/petstore/models/animal.cr new file mode 100644 index 000000000000..3db7c38d4003 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/animal.cr @@ -0,0 +1,55 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class Animal + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Polymorphic (de)serialisation: dispatch on the discriminator to the mapped subtype. + use_json_discriminator "className", {"CAT" => Cat, "DOG" => Dog} + use_yaml_discriminator "className", {"CAT" => Cat, "DOG" => Dog} + + # Required properties + @[JSON::Field(key: "className", emit_null: false)] + property class_name : String + + # Optional properties + @[JSON::Field(key: "color", emit_null: false)] + property color : String? = "red" + + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :"class_name" + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@class_name : String, @color : String? = "red") + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(class_name, color) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/another_property_name_mapping.cr b/samples/client/petstore/crystal/src/petstore/models/another_property_name_mapping.cr deleted file mode 100644 index b39c3afccaa5..000000000000 --- a/samples/client/petstore/crystal/src/petstore/models/another_property_name_mapping.cr +++ /dev/null @@ -1,115 +0,0 @@ -# #OpenAPI Petstore -# -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -#The version of the OpenAPI document: 1.0.0 -# -#Generated by: https://openapi-generator.tech -#Generator version: 7.24.0-SNAPSHOT -# - -module Petstore - class AnotherPropertyNameMapping - include JSON::Serializable - include YAML::Serializable - - # Optional properties - @[JSON::Field(key: "http_debug_operation", type: String?, nillable: true, emit_null: false)] - property http_debug_operation : String? - - @[JSON::Field(key: "_type", type: String?, nillable: true, emit_null: false)] - property underscore_type : String? - - @[JSON::Field(key: "type", type: String?, nillable: true, emit_null: false)] - property _type : String? - - @[JSON::Field(key: "type_", type: String?, nillable: true, emit_null: false)] - property type_with_underscore : String? - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(@http_debug_operation : String? = nil, @underscore_type : String? = nil, @_type : String? = nil, @type_with_underscore : String? = nil) - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array(String).new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - http_debug_operation == other.http_debug_operation && - underscore_type == other.underscore_type && - _type == other._type && - type_with_underscore == other.type_with_underscore - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [http_debug_operation, underscore_type, _type, type_with_underscore].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["http_debug_operation"] = _to_h(http_debug_operation) - hash["_type"] = _to_h(underscore_type) - hash["type"] = _to_h(_type) - hash["type_"] = _to_h(type_with_underscore) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end - end - - end - -end diff --git a/samples/client/petstore/crystal/src/petstore/models/api_response.cr b/samples/client/petstore/crystal/src/petstore/models/api_response.cr index d1d418a29e10..ec74fbbb95b4 100644 --- a/samples/client/petstore/crystal/src/petstore/models/api_response.cr +++ b/samples/client/petstore/crystal/src/petstore/models/api_response.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -9,21 +7,23 @@ # module Petstore - # Describes the result of uploading an image resource class ApiResponse include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation # Optional properties - @[JSON::Field(key: "code", type: Int32?, nillable: true, emit_null: false)] + @[JSON::Field(key: "code", emit_null: false)] property code : Int32? - @[JSON::Field(key: "type", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "type", emit_null: false)] property _type : String? - @[JSON::Field(key: "message", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "message", emit_null: false)] property message : String? + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(@code : Int32? = nil, @_type : String? = nil, @message : String? = nil) @@ -39,73 +39,10 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - code == other.code && - _type == other._type && - message == other.message - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [code, _type, message].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["code"] = _to_h(code) - hash["type"] = _to_h(_type) - hash["message"] = _to_h(message) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(code, _type, message) end end diff --git a/samples/client/petstore/crystal/src/petstore/models/array_of_array_of_number_only.cr b/samples/client/petstore/crystal/src/petstore/models/array_of_array_of_number_only.cr new file mode 100644 index 000000000000..571420b548b4 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/array_of_array_of_number_only.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ArrayOfArrayOfNumberOnly + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "ArrayArrayNumber", emit_null: false)] + property array_array_number : Array(Array(Float64))? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@array_array_number : Array(Array(Float64))? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(array_array_number) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/array_of_number_only.cr b/samples/client/petstore/crystal/src/petstore/models/array_of_number_only.cr new file mode 100644 index 000000000000..49c40b671d5e --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/array_of_number_only.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ArrayOfNumberOnly + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "ArrayNumber", emit_null: false)] + property array_number : Array(Float64)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@array_number : Array(Float64)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(array_number) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/array_test.cr b/samples/client/petstore/crystal/src/petstore/models/array_test.cr new file mode 100644 index 000000000000..972040bb433e --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/array_test.cr @@ -0,0 +1,48 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ArrayTest + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "array_of_string", emit_null: false)] + property array_of_string : Array(String)? + + @[JSON::Field(key: "array_array_of_integer", emit_null: false)] + property array_array_of_integer : Array(Array(Int64))? + + @[JSON::Field(key: "array_array_of_model", emit_null: false)] + property array_array_of_model : Array(Array(ReadOnlyFirst))? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@array_of_string : Array(String)? = nil, @array_array_of_integer : Array(Array(Int64))? = nil, @array_array_of_model : Array(Array(ReadOnlyFirst))? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(array_of_string, array_array_of_integer, array_array_of_model) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/capitalization.cr b/samples/client/petstore/crystal/src/petstore/models/capitalization.cr new file mode 100644 index 000000000000..4f13c4669727 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/capitalization.cr @@ -0,0 +1,58 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class Capitalization + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "smallCamel", emit_null: false)] + property small_camel : String? + + @[JSON::Field(key: "CapitalCamel", emit_null: false)] + property capital_camel : String? + + @[JSON::Field(key: "small_Snake", emit_null: false)] + property small_snake : String? + + @[JSON::Field(key: "Capital_Snake", emit_null: false)] + property capital_snake : String? + + @[JSON::Field(key: "SCA_ETH_Flow_Points", emit_null: false)] + property sca_eth_flow_points : String? + + # Name of the pet + @[JSON::Field(key: "ATT_NAME", emit_null: false)] + property att_name : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@small_camel : String? = nil, @capital_camel : String? = nil, @small_snake : String? = nil, @capital_snake : String? = nil, @sca_eth_flow_points : String? = nil, @att_name : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/cat.cr b/samples/client/petstore/crystal/src/petstore/models/cat.cr new file mode 100644 index 000000000000..fe03e6d872e9 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/cat.cr @@ -0,0 +1,51 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class Cat < Animal + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Required properties + # Optional properties + @[JSON::Field(key: "declawed", emit_null: false)] + property declawed : Bool? + + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :"Animal" + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(class_name : String, @declawed : Bool? = nil, color : String? = "red") + super(class_name, color) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(declawed) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/category.cr b/samples/client/petstore/crystal/src/petstore/models/category.cr index 5ab2bd97b50d..232ccd1e9623 100644 --- a/samples/client/petstore/crystal/src/petstore/models/category.cr +++ b/samples/client/petstore/crystal/src/petstore/models/category.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -9,115 +7,40 @@ # module Petstore - # A category for a pet class Category include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Required properties + @[JSON::Field(key: "name", emit_null: false)] + property name : String # Optional properties - @[JSON::Field(key: "id", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "id", emit_null: false)] property id : Int64? - @[JSON::Field(key: "name", type: String?, nillable: true, emit_null: false)] - property name : String? # Initializes the object # @param [Hash] attributes Model attributes in the form of hash - def initialize(@id : Int64? = nil, @name : String? = nil) + def initialize(@name : String, @id : Int64? = nil) end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array(String).new - pattern = /^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/ - if !@name.nil? && @name.try &.!~ pattern - invalid_properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.") - end - invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if !@name.nil? && @name.try &.!~ /^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/ - true - end - - # Custom attribute writer method with validation - # @param [Object] name Value to be assigned - def name=(name) - pattern = /^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/ - if !name.nil? && name !~ pattern - raise ArgumentError.new("invalid value for \"name\", must conform to the pattern #{pattern}.") - end - - @name = name - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - id == other.id && - name == other.name - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, name].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["id"] = _to_h(id) - hash["name"] = _to_h(name) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(id, name) end end diff --git a/samples/client/petstore/crystal/src/petstore/models/child_with_nullable.cr b/samples/client/petstore/crystal/src/petstore/models/child_with_nullable.cr new file mode 100644 index 000000000000..d7414435d2c1 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/child_with_nullable.cr @@ -0,0 +1,50 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ChildWithNullable < ParentWithNullable + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "otherProperty", emit_null: false)] + property other_property : String? + + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :"ParentWithNullable" + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@other_property : String? = nil, _type : String? = nil, nullable_property : String? = nil) + super(_type, nullable_property) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(other_property) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/class_model.cr b/samples/client/petstore/crystal/src/petstore/models/class_model.cr new file mode 100644 index 000000000000..2cb7669c7408 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/class_model.cr @@ -0,0 +1,43 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # Model for testing model with \"_class\" property + class ClassModel + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "_class", emit_null: false)] + property _class : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_class : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_class) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/deprecated_object.cr b/samples/client/petstore/crystal/src/petstore/models/deprecated_object.cr new file mode 100644 index 000000000000..20fdc8b35a94 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/deprecated_object.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class DeprecatedObject + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "name", emit_null: false)] + property name : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/dog.cr b/samples/client/petstore/crystal/src/petstore/models/dog.cr new file mode 100644 index 000000000000..983022be13e1 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/dog.cr @@ -0,0 +1,51 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class Dog < Animal + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Required properties + # Optional properties + @[JSON::Field(key: "breed", emit_null: false)] + property breed : String? + + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :"Animal" + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(class_name : String, @breed : String? = nil, color : String? = "red") + super(class_name, color) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(breed) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/enum_arrays.cr b/samples/client/petstore/crystal/src/petstore/models/enum_arrays.cr new file mode 100644 index 000000000000..d532cda1b3e4 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/enum_arrays.cr @@ -0,0 +1,49 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class EnumArrays + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "just_symbol", emit_null: false)] + property just_symbol : String? + + @[JSON::Field(key: "array_enum", emit_null: false)] + property array_enum : Array(String)? + + validates(just_symbol, String, true, enum: [">=", "$"]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@just_symbol : String? = nil, @array_enum : Array(String)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = just_symbol_validation_error(@just_symbol)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(just_symbol, array_enum) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/enum_class.cr b/samples/client/petstore/crystal/src/petstore/models/enum_class.cr new file mode 100644 index 000000000000..0f8bc730a057 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/enum_class.cr @@ -0,0 +1,15 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # EnumClass (OpenAPI enum). Allowed values: "_abc", "-efg", "(xyz)". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias EnumClass = String + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/enum_test.cr b/samples/client/petstore/crystal/src/petstore/models/enum_test.cr new file mode 100644 index 000000000000..6b9a4648cab9 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/enum_test.cr @@ -0,0 +1,80 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class EnumTest + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Required properties + @[JSON::Field(key: "enum_string_required", emit_null: false)] + property enum_string_required : String + + # Optional properties + @[JSON::Field(key: "enum_string", emit_null: false)] + property enum_string : String? + + @[JSON::Field(key: "enum_integer", emit_null: false)] + property enum_integer : Int32? + + @[JSON::Field(key: "enum_number", emit_null: false)] + property enum_number : Float64? + + @[JSON::Field(key: "outerEnum", emit_null: false)] + property outer_enum : OuterEnum? + + @[JSON::Field(key: "outerEnumInteger", emit_null: false)] + property outer_enum_integer : OuterEnumInteger? + + @[JSON::Field(key: "outerEnumDefaultValue", emit_null: false)] + property outer_enum_default_value : OuterEnumDefaultValue? = "placed" + + @[JSON::Field(key: "outerEnumIntegerDefaultValue", emit_null: false)] + property outer_enum_integer_default_value : OuterEnumIntegerDefaultValue? + + validates(enum_string, String, true, enum: ["UPPER", "lower", ""]) + validates(enum_string_required, String, false, enum: ["UPPER", "lower", ""]) + validates(enum_integer, Int32, true, enum: [1, -1]) + validates(enum_number, Float64, true, enum: [1.1, -1.2]) + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@enum_string_required : String, @enum_string : String? = nil, @enum_integer : Int32? = nil, @enum_number : Float64? = nil, @outer_enum : OuterEnum? = nil, @outer_enum_integer : OuterEnumInteger? = nil, @outer_enum_default_value : OuterEnumDefaultValue? = "placed", @outer_enum_integer_default_value : OuterEnumIntegerDefaultValue? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = enum_string_validation_error(@enum_string)) + invalid_properties.push(msg) + end + if (msg = enum_string_required_validation_error(@enum_string_required)) + invalid_properties.push(msg) + end + if (msg = enum_integer_validation_error(@enum_integer)) + invalid_properties.push(msg) + end + if (msg = enum_number_validation_error(@enum_number)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(enum_string, enum_string_required, enum_integer, enum_number, outer_enum, outer_enum_integer, outer_enum_default_value, outer_enum_integer_default_value) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/fake_big_decimal_map200_response.cr b/samples/client/petstore/crystal/src/petstore/models/fake_big_decimal_map200_response.cr new file mode 100644 index 000000000000..2897514d0a27 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/fake_big_decimal_map200_response.cr @@ -0,0 +1,45 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class FakeBigDecimalMap200Response + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "someId", emit_null: false)] + property some_id : Float64? + + @[JSON::Field(key: "someMap", emit_null: false)] + property some_map : Hash(String, Float64)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@some_id : Float64? = nil, @some_map : Hash(String, Float64)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(some_id, some_map) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/file.cr b/samples/client/petstore/crystal/src/petstore/models/file.cr new file mode 100644 index 000000000000..1f2c9a04ed77 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/file.cr @@ -0,0 +1,44 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # Must be named `File` for test. + class File + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + # Test capitalization + @[JSON::Field(key: "sourceURI", emit_null: false)] + property source_uri : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@source_uri : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(source_uri) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/file_schema_test_class.cr b/samples/client/petstore/crystal/src/petstore/models/file_schema_test_class.cr new file mode 100644 index 000000000000..e907c35b1eef --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/file_schema_test_class.cr @@ -0,0 +1,45 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class FileSchemaTestClass + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "file", emit_null: false)] + property file : File? + + @[JSON::Field(key: "files", emit_null: false)] + property files : Array(File)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@file : File? = nil, @files : Array(File)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(file, files) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/foo.cr b/samples/client/petstore/crystal/src/petstore/models/foo.cr new file mode 100644 index 000000000000..7de7d540fe11 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/foo.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class Foo + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "bar", emit_null: false)] + property bar : String? = "bar" + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@bar : String? = "bar") + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(bar) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/foo_get_default_response.cr b/samples/client/petstore/crystal/src/petstore/models/foo_get_default_response.cr new file mode 100644 index 000000000000..190a2c79cfdc --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/foo_get_default_response.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class FooGetDefaultResponse + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "string", emit_null: false)] + property string : Foo? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@string : Foo? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(string) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/format_test.cr b/samples/client/petstore/crystal/src/petstore/models/format_test.cr index d4f5990267be..d3c66f198088 100644 --- a/samples/client/petstore/crystal/src/petstore/models/format_test.cr +++ b/samples/client/petstore/crystal/src/petstore/models/format_test.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -12,59 +10,71 @@ module Petstore class FormatTest include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation # Required properties - @[JSON::Field(key: "number", type: Float64, nillable: false, emit_null: false)] + @[JSON::Field(key: "number", emit_null: false)] property number : Float64 - @[JSON::Field(key: "byte", type: String, nillable: false, emit_null: false)] + @[JSON::Field(key: "byte", emit_null: false)] property byte : String - @[JSON::Field(key: "date", type: Time, nillable: false, emit_null: false)] + @[JSON::Field(key: "date", emit_null: false)] property date : Time - @[JSON::Field(key: "password", type: String, nillable: false, emit_null: false)] + @[JSON::Field(key: "password", emit_null: false)] property password : String # Optional properties - @[JSON::Field(key: "integer", type: Int32?, nillable: true, emit_null: false)] + @[JSON::Field(key: "integer", emit_null: false)] property integer : Int32? - @[JSON::Field(key: "int32", type: Int32?, nillable: true, emit_null: false)] + @[JSON::Field(key: "int32", emit_null: false)] property int32 : Int32? - @[JSON::Field(key: "int64", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "int64", emit_null: false)] property int64 : Int64? - @[JSON::Field(key: "float", type: Float32?, nillable: true, emit_null: false)] + @[JSON::Field(key: "float", emit_null: false)] property float : Float32? - @[JSON::Field(key: "double", type: Float64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "double", emit_null: false)] property double : Float64? - @[JSON::Field(key: "decimal", type: BigDecimal?, nillable: true, emit_null: false)] + @[JSON::Field(key: "decimal", emit_null: false)] property decimal : BigDecimal? - @[JSON::Field(key: "string", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "string", emit_null: false)] property string : String? - @[JSON::Field(key: "binary", type: ::File?, nillable: true, emit_null: false)] + @[JSON::Field(key: "binary", emit_null: false)] property binary : ::File? - @[JSON::Field(key: "dateTime", type: Time?, nillable: true, emit_null: false)] + @[JSON::Field(key: "dateTime", emit_null: false)] property date_time : Time? - @[JSON::Field(key: "uuid", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "uuid", emit_null: false)] property uuid : String? # A string that is a 10 digit number. Can have leading zeros. - @[JSON::Field(key: "pattern_with_digits", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "pattern_with_digits", emit_null: false)] property pattern_with_digits : String? # A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. - @[JSON::Field(key: "pattern_with_digits_and_delimiter", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "pattern_with_digits_and_delimiter", emit_null: false)] property pattern_with_digits_and_delimiter : String? + validates(integer, Int32, true, maximum: 100, minimum: 10) + validates(int32, Int32, true, maximum: 200, minimum: 20) + validates(number, Float64, false, maximum: 543.2, minimum: 32.1) + validates(float, Float32, true, maximum: 987.6, minimum: 54.3) + validates(double, Float64, true, maximum: 123.4, minimum: 67.8) + validates(string, String, true, pattern: /[a-z]/i) + validates(password, String, false, max_length: 64, min_length: 10) + validates(pattern_with_digits, String, true, pattern: /^\d{10}$/) + validates(pattern_with_digits_and_delimiter, String, true, pattern: /^image_\d{1,3}$/i) + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(@number : Float64, @byte : String, @date : Time, @password : String, @integer : Int32? = nil, @int32 : Int32? = nil, @int64 : Int64? = nil, @float : Float32? = nil, @double : Float64? = nil, @decimal : BigDecimal? = nil, @string : String? = nil, @binary : ::File? = nil, @date_time : Time? = nil, @uuid : String? = nil, @pattern_with_digits : String? = nil, @pattern_with_digits_and_delimiter : String? = nil) @@ -74,300 +84,43 @@ module Petstore # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array(String).new - if !@integer.nil? && @integer.try &.> 100 - invalid_properties.push("invalid value for \"integer\", must be smaller than or equal to 100.") - end - - if !@integer.nil? && @integer.try &.< 10 - invalid_properties.push("invalid value for \"integer\", must be greater than or equal to 10.") - end - - if !@int32.nil? && @int32.try &.> 200 - invalid_properties.push("invalid value for \"int32\", must be smaller than or equal to 200.") - end - - if !@int32.nil? && @int32.try &.< 20 - invalid_properties.push("invalid value for \"int32\", must be greater than or equal to 20.") - end - - if @number.try &.> 543.2 - invalid_properties.push("invalid value for \"number\", must be smaller than or equal to 543.2.") - end - - if @number.try &.< 32.1 - invalid_properties.push("invalid value for \"number\", must be greater than or equal to 32.1.") + if (msg = integer_validation_error(@integer)) + invalid_properties.push(msg) end - - if !@float.nil? && @float.try &.> 987.6 - invalid_properties.push("invalid value for \"float\", must be smaller than or equal to 987.6.") + if (msg = int32_validation_error(@int32)) + invalid_properties.push(msg) end - - if !@float.nil? && @float.try &.< 54.3 - invalid_properties.push("invalid value for \"float\", must be greater than or equal to 54.3.") + if (msg = number_validation_error(@number)) + invalid_properties.push(msg) end - - if !@double.nil? && @double.try &.> 123.4 - invalid_properties.push("invalid value for \"double\", must be smaller than or equal to 123.4.") + if (msg = float_validation_error(@float)) + invalid_properties.push(msg) end - - if !@double.nil? && @double.try &.< 67.8 - invalid_properties.push("invalid value for \"double\", must be greater than or equal to 67.8.") + if (msg = double_validation_error(@double)) + invalid_properties.push(msg) end - - pattern = /[a-z]/i - if !@string.nil? && @string.try &.!~ pattern - invalid_properties.push("invalid value for \"string\", must conform to the pattern #{pattern}.") + if (msg = string_validation_error(@string)) + invalid_properties.push(msg) end - - if @password.try &.to_s.try &.size.try &.> 64 - invalid_properties.push("invalid value for \"password\", the character length must be smaller than or equal to 64.") + if (msg = password_validation_error(@password)) + invalid_properties.push(msg) end - - if @password.try &.to_s.try &.size.try &.< 10 - invalid_properties.push("invalid value for \"password\", the character length must be greater than or equal to 10.") + if (msg = pattern_with_digits_validation_error(@pattern_with_digits)) + invalid_properties.push(msg) end - - pattern = /^\d{10}$/ - if !@pattern_with_digits.nil? && @pattern_with_digits.try &.!~ pattern - invalid_properties.push("invalid value for \"pattern_with_digits\", must conform to the pattern #{pattern}.") - end - - pattern = /^image_\d{1,3}$/i - if !@pattern_with_digits_and_delimiter.nil? && @pattern_with_digits_and_delimiter.try &.!~ pattern - invalid_properties.push("invalid value for \"pattern_with_digits_and_delimiter\", must conform to the pattern #{pattern}.") + if (msg = pattern_with_digits_and_delimiter_validation_error(@pattern_with_digits_and_delimiter)) + invalid_properties.push(msg) end - invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return false if !@integer.nil? && @integer.try &.> 100 - return false if !@integer.nil? && @integer.try &.< 10 - return false if !@int32.nil? && @int32.try &.> 200 - return false if !@int32.nil? && @int32.try &.< 20 - return false if @number.try &.> 543.2 - return false if @number.try &.< 32.1 - return false if !@float.nil? && @float.try &.> 987.6 - return false if !@float.nil? && @float.try &.< 54.3 - return false if !@double.nil? && @double.try &.> 123.4 - return false if !@double.nil? && @double.try &.< 67.8 - return false if !@string.nil? && @string.try &.!~ /[a-z]/i - return false if @password.try &.to_s.try &.size.try &.> 64 - return false if @password.try &.to_s.try &.size.try &.< 10 - return false if !@pattern_with_digits.nil? && @pattern_with_digits.try &.!~ /^\d{10}$/ - return false if !@pattern_with_digits_and_delimiter.nil? && @pattern_with_digits_and_delimiter.try &.!~ /^image_\d{1,3}$/i - true - end - - # Custom attribute writer method with validation - # @param [Object] integer Value to be assigned - def integer=(integer) - if !integer.nil? && integer > 100 - raise ArgumentError.new("invalid value for \"integer\", must be smaller than or equal to 100.") - end - - if !integer.nil? && integer < 10 - raise ArgumentError.new("invalid value for \"integer\", must be greater than or equal to 10.") - end - - @integer = integer - end - - # Custom attribute writer method with validation - # @param [Object] int32 Value to be assigned - def int32=(int32) - if !int32.nil? && int32 > 200 - raise ArgumentError.new("invalid value for \"int32\", must be smaller than or equal to 200.") - end - - if !int32.nil? && int32 < 20 - raise ArgumentError.new("invalid value for \"int32\", must be greater than or equal to 20.") - end - - @int32 = int32 - end - - # Custom attribute writer method with validation - # @param [Object] number Value to be assigned - def number=(number) - if number > 543.2 - raise ArgumentError.new("invalid value for \"number\", must be smaller than or equal to 543.2.") - end - - if number < 32.1 - raise ArgumentError.new("invalid value for \"number\", must be greater than or equal to 32.1.") - end - - @number = number - end - - # Custom attribute writer method with validation - # @param [Object] float Value to be assigned - def float=(float) - if !float.nil? && float > 987.6 - raise ArgumentError.new("invalid value for \"float\", must be smaller than or equal to 987.6.") - end - - if !float.nil? && float < 54.3 - raise ArgumentError.new("invalid value for \"float\", must be greater than or equal to 54.3.") - end - - @float = float - end - - # Custom attribute writer method with validation - # @param [Object] double Value to be assigned - def double=(double) - if !double.nil? && double > 123.4 - raise ArgumentError.new("invalid value for \"double\", must be smaller than or equal to 123.4.") - end - - if !double.nil? && double < 67.8 - raise ArgumentError.new("invalid value for \"double\", must be greater than or equal to 67.8.") - end - - @double = double - end - - # Custom attribute writer method with validation - # @param [Object] string Value to be assigned - def string=(string) - pattern = /[a-z]/i - if !string.nil? && string !~ pattern - raise ArgumentError.new("invalid value for \"string\", must conform to the pattern #{pattern}.") - end - - @string = string - end - - # Custom attribute writer method with validation - # @param [Object] password Value to be assigned - def password=(password) - if password.to_s.size > 64 - raise ArgumentError.new("invalid value for \"password\", the character length must be smaller than or equal to 64.") - end - - if password.to_s.size < 10 - raise ArgumentError.new("invalid value for \"password\", the character length must be greater than or equal to 10.") - end - - @password = password - end - - # Custom attribute writer method with validation - # @param [Object] pattern_with_digits Value to be assigned - def pattern_with_digits=(pattern_with_digits) - pattern = /^\d{10}$/ - if !pattern_with_digits.nil? && pattern_with_digits !~ pattern - raise ArgumentError.new("invalid value for \"pattern_with_digits\", must conform to the pattern #{pattern}.") - end - - @pattern_with_digits = pattern_with_digits - end - - # Custom attribute writer method with validation - # @param [Object] pattern_with_digits_and_delimiter Value to be assigned - def pattern_with_digits_and_delimiter=(pattern_with_digits_and_delimiter) - pattern = /^image_\d{1,3}$/i - if !pattern_with_digits_and_delimiter.nil? && pattern_with_digits_and_delimiter !~ pattern - raise ArgumentError.new("invalid value for \"pattern_with_digits_and_delimiter\", must conform to the pattern #{pattern}.") - end - - @pattern_with_digits_and_delimiter = pattern_with_digits_and_delimiter - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - integer == other.integer && - int32 == other.int32 && - int64 == other.int64 && - number == other.number && - float == other.float && - double == other.double && - decimal == other.decimal && - string == other.string && - byte == other.byte && - binary == other.binary && - date == other.date && - date_time == other.date_time && - uuid == other.uuid && - password == other.password && - pattern_with_digits == other.pattern_with_digits && - pattern_with_digits_and_delimiter == other.pattern_with_digits_and_delimiter - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [integer, int32, int64, number, float, double, decimal, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["integer"] = _to_h(integer) - hash["int32"] = _to_h(int32) - hash["int64"] = _to_h(int64) - hash["number"] = _to_h(number) - hash["float"] = _to_h(float) - hash["double"] = _to_h(double) - hash["decimal"] = _to_h(decimal) - hash["string"] = _to_h(string) - hash["byte"] = _to_h(byte) - hash["binary"] = _to_h(binary) - hash["date"] = _to_h(date) - hash["dateTime"] = _to_h(date_time) - hash["uuid"] = _to_h(uuid) - hash["password"] = _to_h(password) - hash["pattern_with_digits"] = _to_h(pattern_with_digits) - hash["pattern_with_digits_and_delimiter"] = _to_h(pattern_with_digits_and_delimiter) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(integer, int32, int64, number, float, double, decimal, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter) end end diff --git a/samples/client/petstore/crystal/src/petstore/models/has_only_read_only.cr b/samples/client/petstore/crystal/src/petstore/models/has_only_read_only.cr new file mode 100644 index 000000000000..2e789ed4a56b --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/has_only_read_only.cr @@ -0,0 +1,45 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class HasOnlyReadOnly + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "bar", emit_null: false)] + property bar : String? + + @[JSON::Field(key: "foo", emit_null: false)] + property foo : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@bar : String? = nil, @foo : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(bar, foo) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/health_check_result.cr b/samples/client/petstore/crystal/src/petstore/models/health_check_result.cr new file mode 100644 index 000000000000..9e892bbb5da0 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/health_check_result.cr @@ -0,0 +1,43 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + class HealthCheckResult + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "NullableMessage", emit_null: false)] + property nullable_message : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@nullable_message : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(nullable_message) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/list.cr b/samples/client/petstore/crystal/src/petstore/models/list.cr new file mode 100644 index 000000000000..de5038dd0da6 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/list.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class List + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "123-list", emit_null: false)] + property _123_list : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_123_list : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_123_list) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/map_test.cr b/samples/client/petstore/crystal/src/petstore/models/map_test.cr new file mode 100644 index 000000000000..366b1bcd37ef --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/map_test.cr @@ -0,0 +1,51 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class MapTest + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "map_map_of_string", emit_null: false)] + property map_map_of_string : Hash(String, Hash(String, String))? + + @[JSON::Field(key: "map_of_enum_string", emit_null: false)] + property map_of_enum_string : Hash(String, String)? + + @[JSON::Field(key: "direct_map", emit_null: false)] + property direct_map : Hash(String, Bool)? + + @[JSON::Field(key: "indirect_map", emit_null: false)] + property indirect_map : Hash(String, Bool)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@map_map_of_string : Hash(String, Hash(String, String))? = nil, @map_of_enum_string : Hash(String, String)? = nil, @direct_map : Hash(String, Bool)? = nil, @indirect_map : Hash(String, Bool)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(map_map_of_string, map_of_enum_string, direct_map, indirect_map) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/mixed_properties_and_additional_properties_class.cr b/samples/client/petstore/crystal/src/petstore/models/mixed_properties_and_additional_properties_class.cr new file mode 100644 index 000000000000..72830af02788 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/mixed_properties_and_additional_properties_class.cr @@ -0,0 +1,48 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class MixedPropertiesAndAdditionalPropertiesClass + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "uuid", emit_null: false)] + property uuid : String? + + @[JSON::Field(key: "dateTime", emit_null: false)] + property date_time : Time? + + @[JSON::Field(key: "map", emit_null: false)] + property map : Hash(String, Animal)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@uuid : String? = nil, @date_time : Time? = nil, @map : Hash(String, Animal)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(uuid, date_time, map) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/model200_response.cr b/samples/client/petstore/crystal/src/petstore/models/model200_response.cr new file mode 100644 index 000000000000..64b90161cf7b --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/model200_response.cr @@ -0,0 +1,46 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # Model for testing model name starting with number + class Model200Response + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "name", emit_null: false)] + property name : Int32? + + @[JSON::Field(key: "class", emit_null: false)] + property _class : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : Int32? = nil, @_class : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, _class) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/model_client.cr b/samples/client/petstore/crystal/src/petstore/models/model_client.cr new file mode 100644 index 000000000000..d3d342de8b58 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/model_client.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ModelClient + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "client", emit_null: false)] + property client : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@client : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(client) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/model_return.cr b/samples/client/petstore/crystal/src/petstore/models/model_return.cr new file mode 100644 index 000000000000..331ae18ca1ad --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/model_return.cr @@ -0,0 +1,43 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # Model for testing reserved words + class ModelReturn + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "return", emit_null: false)] + property _return : Int32? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_return : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_return) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/name.cr b/samples/client/petstore/crystal/src/petstore/models/name.cr new file mode 100644 index 000000000000..4b7cc0548fd4 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/name.cr @@ -0,0 +1,53 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # Model for testing model name same as property name + class Name + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Required properties + @[JSON::Field(key: "name", emit_null: false)] + property name : Int32 + + # Optional properties + @[JSON::Field(key: "snake_case", emit_null: false)] + property snake_case : Int32? + + @[JSON::Field(key: "property", emit_null: false)] + property property : String? + + @[JSON::Field(key: "123Number", emit_null: false)] + property _123_number : Int32? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@name : Int32, @snake_case : Int32? = nil, @property : String? = nil, @_123_number : Int32? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(name, snake_case, property, _123_number) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/nullable_class.cr b/samples/client/petstore/crystal/src/petstore/models/nullable_class.cr new file mode 100644 index 000000000000..046a456352e8 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/nullable_class.cr @@ -0,0 +1,77 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class NullableClass + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + # Preserve unknown JSON keys (additionalProperties) across a (de)serialisation round-trip. + include JSON::Serializable::Unmapped + + # Optional properties + @[JSON::Field(key: "integer_prop", emit_null: false)] + property integer_prop : Int32? + + @[JSON::Field(key: "number_prop", emit_null: false)] + property number_prop : Float64? + + @[JSON::Field(key: "boolean_prop", emit_null: false)] + property boolean_prop : Bool? + + @[JSON::Field(key: "string_prop", emit_null: false)] + property string_prop : String? + + @[JSON::Field(key: "date_prop", emit_null: false)] + property date_prop : Time? + + @[JSON::Field(key: "datetime_prop", emit_null: false)] + property datetime_prop : Time? + + @[JSON::Field(key: "array_nullable_prop", emit_null: false)] + property array_nullable_prop : Array(JSON::Any)? + + @[JSON::Field(key: "array_and_items_nullable_prop", emit_null: false)] + property array_and_items_nullable_prop : Array(JSON::Any)? + + @[JSON::Field(key: "array_items_nullable", emit_null: false)] + property array_items_nullable : Array(JSON::Any)? + + @[JSON::Field(key: "object_nullable_prop", emit_null: false)] + property object_nullable_prop : Hash(String, JSON::Any)? + + @[JSON::Field(key: "object_and_items_nullable_prop", emit_null: false)] + property object_and_items_nullable_prop : Hash(String, JSON::Any)? + + @[JSON::Field(key: "object_items_nullable", emit_null: false)] + property object_items_nullable : Hash(String, JSON::Any)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@integer_prop : Int32? = nil, @number_prop : Float64? = nil, @boolean_prop : Bool? = nil, @string_prop : String? = nil, @date_prop : Time? = nil, @datetime_prop : Time? = nil, @array_nullable_prop : Array(JSON::Any)? = nil, @array_and_items_nullable_prop : Array(JSON::Any)? = nil, @array_items_nullable : Array(JSON::Any)? = nil, @object_nullable_prop : Hash(String, JSON::Any)? = nil, @object_and_items_nullable_prop : Hash(String, JSON::Any)? = nil, @object_items_nullable : Hash(String, JSON::Any)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(integer_prop, number_prop, boolean_prop, string_prop, date_prop, datetime_prop, array_nullable_prop, array_and_items_nullable_prop, array_items_nullable, object_nullable_prop, object_and_items_nullable_prop, object_items_nullable) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/number_only.cr b/samples/client/petstore/crystal/src/petstore/models/number_only.cr new file mode 100644 index 000000000000..ed236d7b3559 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/number_only.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class NumberOnly + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "JustNumber", emit_null: false)] + property just_number : Float64? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@just_number : Float64? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(just_number) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/object_with_deprecated_fields.cr b/samples/client/petstore/crystal/src/petstore/models/object_with_deprecated_fields.cr new file mode 100644 index 000000000000..f933504cfa91 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/object_with_deprecated_fields.cr @@ -0,0 +1,51 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ObjectWithDeprecatedFields + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "uuid", emit_null: false)] + property uuid : String? + + @[JSON::Field(key: "id", emit_null: false)] + property id : Float64? + + @[JSON::Field(key: "deprecatedRef", emit_null: false)] + property deprecated_ref : DeprecatedObject? + + @[JSON::Field(key: "bars", emit_null: false)] + property bars : Array(String)? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@uuid : String? = nil, @id : Float64? = nil, @deprecated_ref : DeprecatedObject? = nil, @bars : Array(String)? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(uuid, id, deprecated_ref, bars) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/order.cr b/samples/client/petstore/crystal/src/petstore/models/order.cr index 886a8127397a..e6146b44eb12 100644 --- a/samples/client/petstore/crystal/src/petstore/models/order.cr +++ b/samples/client/petstore/crystal/src/petstore/models/order.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -9,173 +7,56 @@ # module Petstore - # An order for a pets from the pet store class Order include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation # Optional properties - @[JSON::Field(key: "id", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "id", emit_null: false)] property id : Int64? - @[JSON::Field(key: "petId", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "petId", emit_null: false)] property pet_id : Int64? - @[JSON::Field(key: "quantity", type: Int32?, nillable: true, emit_null: false)] + @[JSON::Field(key: "quantity", emit_null: false)] property quantity : Int32? - @[JSON::Field(key: "shipDate", type: Time?, nillable: true, emit_null: false)] + @[JSON::Field(key: "shipDate", emit_null: false)] property ship_date : Time? # Order Status - @[JSON::Field(key: "status", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "status", emit_null: false)] property status : String? - @[JSON::Field(key: "complete", type: Bool?, default: false, nillable: true, emit_null: false)] - property complete : Bool? - - abstract class EnumAttributeValidator - def valid?(value) - !value || @allowable_values.includes?(value) - end - - def message - "invalid value for \"#{@attribute}\", must be one of #{@allowable_values}." - end - - def to(_type, value) - case _type - when Int32 - value.to_i32 - when Int64 - value.to_i64 - when Float32 - value.to_f32 - when Float64 - value.to_f64 - else - value.to_s - end - end - end - - class EnumAttributeValidatorForStatus < EnumAttributeValidator - @attribute : String - @allowable_values : Array(Int32 | Int64 | Float32 | Float64 | String) - - def initialize - @attribute = "status" - @allowable_values = ["placed", "approved", "delivered"].map { |value| to(String, value)} - end - end + @[JSON::Field(key: "complete", emit_null: false)] + property complete : Bool? = false + validates(status, String, true, enum: ["placed", "approved", "delivered"]) # Initializes the object # @param [Hash] attributes Model attributes in the form of hash - def initialize(@id : Int64? = nil, @pet_id : Int64? = nil, @quantity : Int32? = nil, @ship_date : Time? = nil, @status : String? = nil, @complete : Bool? = nil) + def initialize(@id : Int64? = nil, @pet_id : Int64? = nil, @quantity : Int32? = nil, @ship_date : Time? = nil, @status : String? = nil, @complete : Bool? = false) end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array(String).new - status_validator = EnumAttributeValidatorForStatus.new - if !status_validator.valid?(@status) - message = status_validator.message - invalid_properties.push(message) + if (msg = status_validation_error(@status)) + invalid_properties.push(msg) end - invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - status_validator = EnumAttributeValidatorForStatus.new - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidatorForStatus.new - unless validator.valid?(status) - raise ArgumentError.new(validator.message) - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - id == other.id && - pet_id == other.pet_id && - quantity == other.quantity && - ship_date == other.ship_date && - status == other.status && - complete == other.complete - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, pet_id, quantity, ship_date, status, complete].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["id"] = _to_h(id) - hash["petId"] = _to_h(pet_id) - hash["quantity"] = _to_h(quantity) - hash["shipDate"] = _to_h(ship_date) - hash["status"] = _to_h(status) - hash["complete"] = _to_h(complete) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(id, pet_id, quantity, ship_date, status, complete) end end diff --git a/samples/client/petstore/crystal/src/petstore/models/outer_composite.cr b/samples/client/petstore/crystal/src/petstore/models/outer_composite.cr new file mode 100644 index 000000000000..a712f34d95d8 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/outer_composite.cr @@ -0,0 +1,48 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class OuterComposite + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "my_number", emit_null: false)] + property my_number : Float64? + + @[JSON::Field(key: "my_string", emit_null: false)] + property my_string : String? + + @[JSON::Field(key: "my_boolean", emit_null: false)] + property my_boolean : Bool? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@my_number : Float64? = nil, @my_string : String? = nil, @my_boolean : Bool? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(my_number, my_string, my_boolean) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/outer_enum.cr b/samples/client/petstore/crystal/src/petstore/models/outer_enum.cr new file mode 100644 index 000000000000..3dc60fd44924 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/outer_enum.cr @@ -0,0 +1,15 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # OuterEnum (OpenAPI enum). Allowed values: "placed", "approved", "delivered". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias OuterEnum = String + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/outer_enum_default_value.cr b/samples/client/petstore/crystal/src/petstore/models/outer_enum_default_value.cr new file mode 100644 index 000000000000..943b5e03c94c --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/outer_enum_default_value.cr @@ -0,0 +1,15 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # OuterEnumDefaultValue (OpenAPI enum). Allowed values: "placed", "approved", "delivered". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias OuterEnumDefaultValue = String + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/outer_enum_integer.cr b/samples/client/petstore/crystal/src/petstore/models/outer_enum_integer.cr new file mode 100644 index 000000000000..b12b89dac8d2 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/outer_enum_integer.cr @@ -0,0 +1,15 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # OuterEnumInteger (OpenAPI enum). Allowed values: 0, 1, 2. + # Represented as `Int32` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias OuterEnumInteger = Int32 + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/outer_enum_integer_default_value.cr b/samples/client/petstore/crystal/src/petstore/models/outer_enum_integer_default_value.cr new file mode 100644 index 000000000000..e7f288c0a1cb --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/outer_enum_integer_default_value.cr @@ -0,0 +1,15 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # OuterEnumIntegerDefaultValue (OpenAPI enum). Allowed values: 0, 1, 2. + # Represented as `Int32` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias OuterEnumIntegerDefaultValue = Int32 + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/outer_object_with_enum_property.cr b/samples/client/petstore/crystal/src/petstore/models/outer_object_with_enum_property.cr new file mode 100644 index 000000000000..c9886754e168 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/outer_object_with_enum_property.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class OuterObjectWithEnumProperty + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Required properties + @[JSON::Field(key: "value", emit_null: false)] + property value : OuterEnumInteger + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@value : OuterEnumInteger) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(value) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/parent_with_nullable.cr b/samples/client/petstore/crystal/src/petstore/models/parent_with_nullable.cr new file mode 100644 index 000000000000..ebaeb60afb48 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/parent_with_nullable.cr @@ -0,0 +1,58 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ParentWithNullable + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Polymorphic (de)serialisation: dispatch on the discriminator to the mapped subtype. + use_json_discriminator "type", {"ChildWithNullable" => ChildWithNullable} + use_yaml_discriminator "type", {"ChildWithNullable" => ChildWithNullable} + + # Optional properties + @[JSON::Field(key: "type", emit_null: false)] + property _type : String? + + @[JSON::Field(key: "nullableProperty", emit_null: false)] + property nullable_property : String? + + validates(_type, String, true, enum: ["ChildWithNullable"]) + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :"_type" + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@_type : String? = nil, @nullable_property : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + if (msg = _type_validation_error(@_type)) + invalid_properties.push(msg) + end + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(_type, nullable_property) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/pet.cr b/samples/client/petstore/crystal/src/petstore/models/pet.cr index 3e4683d02c26..6c1028b602bd 100644 --- a/samples/client/petstore/crystal/src/petstore/models/pet.cr +++ b/samples/client/petstore/crystal/src/petstore/models/pet.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -9,174 +7,57 @@ # module Petstore - # A pet for sale in the pet store class Pet include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation # Required properties - @[JSON::Field(key: "name", type: String, nillable: false, emit_null: false)] + @[JSON::Field(key: "name", emit_null: false)] property name : String - @[JSON::Field(key: "photoUrls", type: Array(String), nillable: false, emit_null: false)] - property photo_urls : Array(String) + @[JSON::Field(key: "photoUrls", emit_null: false)] + property photo_urls : Set(String) # Optional properties - @[JSON::Field(key: "id", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "id", emit_null: false)] property id : Int64? - @[JSON::Field(key: "category", type: Category?, nillable: true, emit_null: false)] + @[JSON::Field(key: "category", emit_null: false)] property category : Category? - @[JSON::Field(key: "tags", type: Array(Tag)?, nillable: true, emit_null: false)] + @[JSON::Field(key: "tags", emit_null: false)] property tags : Array(Tag)? # pet status in the store - @[JSON::Field(key: "status", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "status", emit_null: false)] property status : String? - abstract class EnumAttributeValidator - def valid?(value) - !value || @allowable_values.includes?(value) - end - - def message - "invalid value for \"#{@attribute}\", must be one of #{@allowable_values}." - end - - def to(_type, value) - case _type - when Int32 - value.to_i32 - when Int64 - value.to_i64 - when Float32 - value.to_f32 - when Float64 - value.to_f64 - else - value.to_s - end - end - end - - class EnumAttributeValidatorForStatus < EnumAttributeValidator - @attribute : String - @allowable_values : Array(Int32 | Int64 | Float32 | Float64 | String) - - def initialize - @attribute = "status" - @allowable_values = ["available", "pending", "sold"].map { |value| to(String, value)} - end - end - + validates(status, String, true, enum: ["available", "pending", "sold"]) # Initializes the object # @param [Hash] attributes Model attributes in the form of hash - def initialize(@name : String, @photo_urls : Array(String), @id : Int64? = nil, @category : Category? = nil, @tags : Array(Tag)? = nil, @status : String? = nil) + def initialize(@name : String, @photo_urls : Set(String), @id : Int64? = nil, @category : Category? = nil, @tags : Array(Tag)? = nil, @status : String? = nil) end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array(String).new - status_validator = EnumAttributeValidatorForStatus.new - if !status_validator.valid?(@status) - message = status_validator.message - invalid_properties.push(message) + if (msg = status_validation_error(@status)) + invalid_properties.push(msg) end - invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - status_validator = EnumAttributeValidatorForStatus.new - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidatorForStatus.new - unless validator.valid?(status) - raise ArgumentError.new(validator.message) - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - id == other.id && - category == other.category && - name == other.name && - photo_urls == other.photo_urls && - tags == other.tags && - status == other.status - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, category, name, photo_urls, tags, status].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["id"] = _to_h(id) - hash["category"] = _to_h(category) - hash["name"] = _to_h(name) - hash["photoUrls"] = _to_h(photo_urls) - hash["tags"] = _to_h(tags) - hash["status"] = _to_h(status) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(id, category, name, photo_urls, tags, status) end end diff --git a/samples/client/petstore/crystal/src/petstore/models/read_only_first.cr b/samples/client/petstore/crystal/src/petstore/models/read_only_first.cr new file mode 100644 index 000000000000..3a84bdc9705f --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/read_only_first.cr @@ -0,0 +1,45 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class ReadOnlyFirst + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "bar", emit_null: false)] + property bar : String? + + @[JSON::Field(key: "baz", emit_null: false)] + property baz : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@bar : String? = nil, @baz : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(bar, baz) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/single_ref_type.cr b/samples/client/petstore/crystal/src/petstore/models/single_ref_type.cr new file mode 100644 index 000000000000..6eb4698b60df --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/single_ref_type.cr @@ -0,0 +1,15 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + # SingleRefType (OpenAPI enum). Allowed values: "admin", "user". + # Represented as `String` so it (de)serialises transparently to/from JSON and YAML, + # consistent with how inline enums are handled (see the `validates(..., enum: [...])` macro). + alias SingleRefType = String + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/special_model_name.cr b/samples/client/petstore/crystal/src/petstore/models/special_model_name.cr new file mode 100644 index 000000000000..ada4b8f0c38c --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/special_model_name.cr @@ -0,0 +1,42 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class SpecialModelName + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + + # Optional properties + @[JSON::Field(key: "$special[property.name]", emit_null: false)] + property special_property_name : Int64? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@special_property_name : Int64? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(special_property_name) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/tag.cr b/samples/client/petstore/crystal/src/petstore/models/tag.cr index 3f089c1ce0ff..ce69022937cf 100644 --- a/samples/client/petstore/crystal/src/petstore/models/tag.cr +++ b/samples/client/petstore/crystal/src/petstore/models/tag.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -9,18 +7,20 @@ # module Petstore - # A tag for a pet class Tag include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation # Optional properties - @[JSON::Field(key: "id", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "id", emit_null: false)] property id : Int64? - @[JSON::Field(key: "name", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "name", emit_null: false)] property name : String? + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(@id : Int64? = nil, @name : String? = nil) @@ -36,71 +36,10 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - id == other.id && - name == other.name - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, name].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["id"] = _to_h(id) - hash["name"] = _to_h(name) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(id, name) end end diff --git a/samples/client/petstore/crystal/src/petstore/models/test_inline_freeform_additional_properties_request.cr b/samples/client/petstore/crystal/src/petstore/models/test_inline_freeform_additional_properties_request.cr new file mode 100644 index 000000000000..be1196de2bbd --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/models/test_inline_freeform_additional_properties_request.cr @@ -0,0 +1,44 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# + +module Petstore + class TestInlineFreeformAdditionalPropertiesRequest + include JSON::Serializable + include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation + # Preserve unknown JSON keys (additionalProperties) across a (de)serialisation round-trip. + include JSON::Serializable::Unmapped + + # Optional properties + @[JSON::Field(key: "someProperty", emit_null: false)] + property some_property : String? + + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(@some_property : String? = nil) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array(String).new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + list_invalid_properties.empty? + end + + def_equals_and_hash(some_property) + end + +end diff --git a/samples/client/petstore/crystal/src/petstore/models/user.cr b/samples/client/petstore/crystal/src/petstore/models/user.cr index 7aea9bd567ff..37e91e64e403 100644 --- a/samples/client/petstore/crystal/src/petstore/models/user.cr +++ b/samples/client/petstore/crystal/src/petstore/models/user.cr @@ -1,7 +1,5 @@ # #OpenAPI Petstore # -##This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# #The version of the OpenAPI document: 1.0.0 # #Generated by: https://openapi-generator.tech @@ -9,37 +7,39 @@ # module Petstore - # A User who is purchasing from the pet store class User include JSON::Serializable include YAML::Serializable + include Petstore::Serializable + include Petstore::Validation # Optional properties - @[JSON::Field(key: "id", type: Int64?, nillable: true, emit_null: false)] + @[JSON::Field(key: "id", emit_null: false)] property id : Int64? - @[JSON::Field(key: "username", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "username", emit_null: false)] property username : String? - @[JSON::Field(key: "firstName", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "firstName", emit_null: false)] property first_name : String? - @[JSON::Field(key: "lastName", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "lastName", emit_null: false)] property last_name : String? - @[JSON::Field(key: "email", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "email", emit_null: false)] property email : String? - @[JSON::Field(key: "password", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "password", emit_null: false)] property password : String? - @[JSON::Field(key: "phone", type: String?, nillable: true, emit_null: false)] + @[JSON::Field(key: "phone", emit_null: false)] property phone : String? # User Status - @[JSON::Field(key: "userStatus", type: Int32?, nillable: true, emit_null: false)] + @[JSON::Field(key: "userStatus", emit_null: false)] property user_status : Int32? + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(@id : Int64? = nil, @username : String? = nil, @first_name : String? = nil, @last_name : String? = nil, @email : String? = nil, @password : String? = nil, @phone : String? = nil, @user_status : Int32? = nil) @@ -55,83 +55,10 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(other) - return true if self.same?(other) - self.class == other.class && - id == other.id && - username == other.username && - first_name == other.first_name && - last_name == other.last_name && - email == other.email && - password == other.password && - phone == other.phone && - user_status == other.user_status - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(other) - self == other - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [id, username, first_name, last_name, email, password, phone, user_status].hash - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_h.to_s - end - - # to_body is an alias to to_h (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_h - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_h - hash = NetboxClient::RecursiveHash.new - hash["id"] = _to_h(id) - hash["username"] = _to_h(username) - hash["firstName"] = _to_h(first_name) - hash["lastName"] = _to_h(last_name) - hash["email"] = _to_h(email) - hash["password"] = _to_h(password) - hash["phone"] = _to_h(phone) - hash["userStatus"] = _to_h(user_status) - hash.to_h - end - - # Outputs non-array value in the form of hash - # For object, use to_h. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - private def _to_h(value) - return nil if value.nil? - - if value.is_a?(Hash) - hash = NetboxClient::RecursiveHash.new - value.each { |k, v| hash[k] = _to_h(v) } - hash - elsif value.is_a?(Array) - value.compact.map { |v| _to_h(v) } - elsif value.responds_to?(:to_h) - value.to_h - else - value - end + list_invalid_properties.empty? end + def_equals_and_hash(id, username, first_name, last_name, email, password, phone, user_status) end end diff --git a/samples/client/petstore/crystal/src/petstore/recursive_hash.cr b/samples/client/petstore/crystal/src/petstore/recursive_hash.cr deleted file mode 100644 index cd3435abf801..000000000000 --- a/samples/client/petstore/crystal/src/petstore/recursive_hash.cr +++ /dev/null @@ -1,18 +0,0 @@ -module Petstore - # Define possible value types for our own AnyHash class (RecursiveHash) - alias ValuesType = Nil | - Bool | - String | - Time | - Int32 | - Int64 | - Float32 | - Float64 | - Array(ValuesType) - - # Define our own AnyHash class (RecursiveHash) - # RecursiveHash - AnyHash.define_new klass: :RecursiveHash, - key: String, - value: ValuesType -end diff --git a/samples/client/petstore/crystal/src/petstore/response.cr b/samples/client/petstore/crystal/src/petstore/response.cr new file mode 100644 index 000000000000..b109a9efe598 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/response.cr @@ -0,0 +1,13 @@ +module Petstore + struct Response(T) + getter value : T + getter status : Int32 + getter headers : HTTP::Headers + + def initialize(@value : T, @status : Int32, @headers : HTTP::Headers); end + + def success? : Bool + 200 <= @status < 300 + end + end +end diff --git a/samples/client/petstore/crystal/src/petstore/serializable.cr b/samples/client/petstore/crystal/src/petstore/serializable.cr new file mode 100644 index 000000000000..bdab9f5707b5 --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/serializable.cr @@ -0,0 +1,33 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# +require "json" + +module Petstore + # Shared serialization helpers mixed into every generated model. + module Serializable + # Returns the string representation of the object + def to_s(io : IO) : Nil + io << to_json + end + + # to_body is an alias to to_h (backward compatibility) + def to_body : Hash(String, JSON::Any) + to_h + end + + # Returns the object in the form of hash + def to_h : Hash(String, JSON::Any) + JSON.parse(to_json).as_h + end + + # @see the `==` method + def eql?(other) + self == other + end + end +end diff --git a/samples/client/petstore/crystal/src/petstore/validation.cr b/samples/client/petstore/crystal/src/petstore/validation.cr new file mode 100644 index 000000000000..e828dcbfeebe --- /dev/null +++ b/samples/client/petstore/crystal/src/petstore/validation.cr @@ -0,0 +1,37 @@ +# #OpenAPI Petstore +# +#The version of the OpenAPI document: 1.0.0 +# +#Generated by: https://openapi-generator.tech +#Generator version: 7.24.0-SNAPSHOT +# +module Petstore + # Shared macro for declarative property validation. Include it in a model and + # declare `validates(name, Type, nilable, **rules)` per validated property. + # Supported rule keys: enum, max_length, min_length, maximum, exclusive_maximum, + # minimum, exclusive_minimum, pattern, max_items, min_items. + module Validation + macro validates(name, klass, nilable, **rules) + {% if rules[:enum] %}{{name.id.upcase}}_ALLOWED = {{rules[:enum]}}{% end %} + + def {{name.id}}=(value : {{klass}}{% if nilable %}?{% end %}) + if (msg = {{name.id}}_validation_error(value)) + raise ArgumentError.new(msg) + end + @{{name.id}} = value + end + + def {{name.id}}_validation_error(value) : String? + {% if rules[:enum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be one of #{ {{name.id.upcase}}_ALLOWED }" unless value.nil? || {{name.id.upcase}}_ALLOWED.includes?(value) + {% end %}{% if rules[:max_length] %}return "invalid value for \"#{ {{name.stringify}} }\", the character length must be smaller than or equal to {{rules[:max_length]}}." if value.try &.to_s.try &.size.try &.> {{rules[:max_length]}} + {% end %}{% if rules[:min_length] %}return "invalid value for \"#{ {{name.stringify}} }\", the character length must be greater than or equal to {{rules[:min_length]}}." if value.try &.to_s.try &.size.try &.< {{rules[:min_length]}} + {% end %}{% if rules[:maximum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be smaller than{% if rules[:exclusive_maximum] %}{% else %} or equal to{% end %} {{rules[:maximum]}}." if value.try &.>{% if rules[:exclusive_maximum] %}={% end %} {{rules[:maximum]}} + {% end %}{% if rules[:minimum] %}return "invalid value for \"#{ {{name.stringify}} }\", must be greater than{% if rules[:exclusive_minimum] %}{% else %} or equal to{% end %} {{rules[:minimum]}}." if value.try &.<{% if rules[:exclusive_minimum] %}={% end %} {{rules[:minimum]}} + {% end %}{% if rules[:pattern] %}return "invalid value for \"#{ {{name.stringify}} }\", must conform to the pattern {{rules[:pattern]}}." if value.try &.!~ {{rules[:pattern]}} + {% end %}{% if rules[:max_items] %}return "invalid value for \"#{ {{name.stringify}} }\", number of items must be less than or equal to {{rules[:max_items]}}." if value.try &.size.try &.> {{rules[:max_items]}} + {% end %}{% if rules[:min_items] %}return "invalid value for \"#{ {{name.stringify}} }\", number of items must be greater than or equal to {{rules[:min_items]}}." if value.try &.size.try &.< {{rules[:min_items]}} + {% end %}nil + end + end + end +end