Open-MBEE / Open-MBEE/flexo-mms-sysmlv2

Error for Query - PrimitiveConstraint value cannot be array

Open
#13 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Bru
Stars
15
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at QueryApi.kt:147 and reproduce the POST to /projects/{projectId}/query-results using the query in the issue. Compare the request handling with the published PrimitiveConstraint schema; done means the array-valued value is accepted without the “PrimitiveConstraint value cannot be array” BadRequestException.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.