[IMPLEMENTED] SchemaName for components

I have…

  • [x ] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [x] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Squidex generated swagger file for components includes schemaId

..
"FaqComponentDto": {
        "type": "object",
        "required": [
          "schemaId"   <----- this?
        ],
        "properties": {
          "question": {
            "type": "string",
            "nullable": true
          },
          "answer": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "number",
            "nullable": true
          },
          "schemaId": {    <----- this?
            "type": "string",
            "nullable": false
          }
        }
      },
..

And we are currently use NSwag to generate sdk and when we use this generated class tu update entity with component I got a error.

{
	"message": "Validation error",
	"traceId": "00-35ab62f31f7abf4f83d3536489bb9805-97781e7e8ca9ea44-00",
	"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
	"details": ["weatherData.iv: Invalid component. No 'schemaId' field found."],
	"statusCode": 400
}

Expected behavior

Client generated from swagger should work.

Minimal reproduction of the problem

Scheme with component (in our tested use-case it is nested-component if that matter). Generate SDK from swagger (nswag). Call update on any item via this API.

Same update is work via front-end admin.

Environment

  • [x] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 5.8.2

It is not a bug. Squidex allows to add different components to one field and therefore you have to define to which schema your component belongs to.

I have it on my internal todo-list to also allow schemaName, but so far this has not been implemented yet.

Ok that will be better. And do you consider make it optimal if component have just one schema? In that case it seems like it can be optimal. In best case component field could be mark to use just one schema.

And by the way component are really cool :slight_smile:

1 Like

Yes, I will consider that when I introduce schemaName.

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.

I have implemented this.

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.