Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-8375

Enhance dataindex for custom support to Primitive Datatypes viz. support for Long/Float/Double etc.

XMLWordPrintable

    • False
    • None
    • False
    • ---
    • ---

      As we know there are only limited support provide option to add more details to register datatypes per need in data index.

       

      At present the way DI works is with the following

      1. default schema created using scheam.graphqls file in data-index-service-common project module
      2. GraphQLScalarTypeProducer registers only DateTime Scalar at present
      3. GraphQLSchemaManager class have .scalar(qlDateTimeScalarType)
      4. GraphQLInputObjectTypeMapper.getInputTypeByField defines the mappings
      5. switch (name) {
                case "Int":
                case "Long":             
                    return getInputObjectType("NumericArgument");
                case "String":
                    return getInputObjectType("StringArgument");
                case "Boolean":
                    return getInputObjectType("BooleanArgument");
                case "DateTime":
                    return getInputObjectType("DateArgument");
                default:
                    String typeName = name + ARGUMENT;
                    GraphQLType schemaType = getExistingType(typeName);
                    if (schemaType == null) {
                        GraphQLObjectType domain = (GraphQLObjectType) getAdditionalTypes().get(name);
                        if (domain == null) {
                            return null;
                        }
                        GraphQLInputObjectType type = new GraphQLInputObjectTypeMapper(getSchema(), getAdditionalTypes(), false).apply(domain);
                        getAdditionalTypes().put(typeName, type);
                        return type;
                    } else {
                        return (GraphQLInputType) schemaType;
                    }
            }
        } 
      1. As you can see both Int and Long mapped to numericArgument which has Int details.

       

        1. schema.graphqls
          11 kB
          Debabrata Patnaik

              nmirasch@redhat.com Neus Miras Chueca
              debabrata_patnaik Debabrata Patnaik (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: