Skip to content

Error for Query - PrimitiveConstraint value cannot be array #13

Description

@philipp-helle

I get an error when I post the following query to the server:

{
	"@type": "Query",
	"select": [
		"@id",
		"@type",
		"reqId",
		"declaredName",
		"body",
		"ownedRelationship",
		"ownedRelatedElement",
		"owningRelatedElement"
	],
	"where": {
		"@type": "CompositeConstraint",
		"operator": "or",
		"constraint": [
			{
				"@type": "PrimitiveConstraint",
				"inverse": false,
				"operator": "=",
				"property": "@type",
				"value": ["RequirementUsage"]
				
			},
			{
				"@type": "PrimitiveConstraint",
				"inverse": false,
				"operator": "=",
				"property": "@type",
				"value": ["Documentation"]
				
			},
			{
				"@type": "PrimitiveConstraint",
				"inverse": false,
				"operator": "=",
				"property": "@type",
				"value": ["OwningMembership"]
				
			}
		]
	}
}

The error is:

2025-10-14 07:46:46.738 [eventLoopGroupProxy-4-16] DEBUG Application - Unhandled: POST - /projects/e2f1b422-9713-4598-8800-ee2f0ffc53a1/query-results. Exception class io.ktor.server.plugins.BadRequestException: PrimitiveConstraint value cannot be array
2025-10-14 07:46:46.737 [eventLoopGroupProxy-4-16] TRACE i.k.server.engine.DefaultTransform - No Default Transformations found for class io.ktor.utils.io.ByteBufferChannel and expected type TypeInfo(type=class org.openmbee.flexo.sysmlv2.models.QueryRequest, reifiedType=class org.openmbee.flexo.sysmlv2.models.QueryRequest, kotlinType=org.openmbee.flexo.sysmlv2.models.QueryRequest) for call /projects/e2f1b422-9713-4598-8800-ee2f0ffc53a1/query-results?commitId=238ebd49-91f5-42e8-87b0-dcf8b139c40c
	at org.openmbee.flexo.sysmlv2.apis.QueryApiKt.runQuery(QueryApi.kt:147)

The same query works with the SysML v2 pilot implementation API server.

The SysML v2 schema defines a PrimitiveConstraint as follows:

"PrimitiveConstraint": {
  "$id": "https://www.omg.org/spec/SystemsModelingAPI/20230201/PrimitiveConstraint",
  "title": "PrimitiveConstraint",
  "type": "object",
  "properties": {
    "@type": {
      "type": "string",
      "const": "PrimitiveConstraint"
    },
    "inverse": {
      "type": "boolean"
    },
    "operator": {
      "type": "string",
      "enum": [
        "<",
        "<=",
        "=",
        ">",
        ">=",
        "in",
        "instanceOf"
      ]
    },
    "property": {
      "type": "string"
    },
    "value": {
      "oneOf": [
        {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "boolean"
              },
              {
                "type": "number"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/Identified"
              },
              {
                "type": "null"
              }
            ]
          },
          "minItems": 1
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "@type",
    "inverse",
    "operator",
    "property",
    "value"
  ],
  "additionalProperties": false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions