json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

What's wrong with schema and layout? #958

Closed person2713 closed 6 years ago

person2713 commented 6 years ago
`{
  "schema": {
  "type": "object",
  "properties": {
    "name": {
        "type": "string"
    },
    "Objects": {
     "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "object": {
            "type": "object",
            "properties": {
              "objectId": {
                "type": "string"
              },
              "attributes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "attributeId": {
                        "type": "string"
                    },
                    "attrbuteName": {
                        "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
},
  "form": [
      "name",
      {
          "key" :"Objects",
          "items": [
              {
                "key":"Objects[].object",
                "items": [
                    "objectId",
                    {
                        "key": "attributes",
                        "items": [
                            "['attributes'][]attributeId",
                            "['attributes'][]attrbuteName",
                            "['attributes'][]value"
                        ]
                    }
                ]
              }
            ]
      }
]
}`

Why I don't see "attributeId", "attrbuteName" and "value"?

scottux commented 6 years ago

This is probably an issue best handled by a question on stackoverflow.com. Your syntax is off. In short, you need to use the full key like Objects[].object.attributes[].attributeId

person2713 commented 6 years ago

You are right, thanks. Can you give me links on documentation, please? Can you give me links on doc, please?

person2713 commented 6 years ago

In general, my purpose is add appear Name of object when user input objectId. May be there is a better idea than add "attrbuteName" to schema and then customize it in layout? Sample: image

scottux commented 6 years ago

Start here for JSON Schema http://json-schema.org/learn/getting-started-step-by-step.html

And then for this library, https://github.com/json-schema-form/angular-schema-form/blob/development/docs/index.md#basic-usage and http://schemaform.io/examples/bootstrap-example.html are the best resources I have found.

Anthropic commented 6 years ago

Thanks @scottux

@person2713 please comment if you want to re-open or do not feel the question has been answered sufficiently.