Comments (9)
@bombompb I used I used https://github.com/izumin5210/json-schema-parser to parse the schema. Produced the form ok for me with local $ref
from ngx-schema-form.
@GermisMc the default widget template mainly use the description (but some use title, see https://github.com/makinacorpus/angular2-schema-form/blob/master/src/defaultwidgets/radio/radio.widget.ts), but you are free to override their template and use {{ schema.title }}
if you prefer.
from ngx-schema-form.
As our objective is to generate a form (and not just use a schema to manipulate some structured data), we had to extend JSON Schema so we can handle form-specific features (like field widget, help messages, fieldsets, etc.).
But we do want to support the standard as closely as possible.
Regarding title
: as far as I know, there is no title attribute for fields, do you mean the schema's title?
Regarding self-reference: what use case do you imagine?
from ngx-schema-form.
An example of a self reference is a schema in which you have a definitions section containing Types, which you then use in the schema properties.
For example:
{
"id": "http://schange.com/schemas/a5sharedconfigschema.json",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"regions": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/regionType"
}
}
},
"definitions": {
"regionType": {
"properties": {
"tag": {
"description": "Tag that uniquely identifies a given region",
"type": "string"
},
"currency": {
"description": "Three letter alphabetic code for the currency from ISO 4217 (XYZ)",
"type": "string",
"pattern": "[A-Z]{3}"
}
},
"required": [
"tag",
"currency"
]
}
}
}
Note: this is a reference within the same schema file. We also would like to make use of references outside the schema file to allow re-use of type definitions.
from ngx-schema-form.
Any plans to add the $ref support to this component?
Besides usage of $ref in Schema, I am also having a use case where I would like to make use of $ref support in the Model json.
from ngx-schema-form.
Until it is implemented, you can resolve the $ref properties by compiling your schema with ZSchema:```
let zschema = new ZSchema({});
zschema.compileSchema(mySchema);
mySchema = zschema.getResolvedSchema(mySchema);
but note that $ref usage is often combined with allOf properties to add additional properties such as title, placeholder, etc... . But allOf is not yet supported. These two features will be added soon.
from ngx-schema-form.
ok, thanks for the answer. Going to test this solution soon.
from ngx-schema-form.
I tested the workaround with the example I posted before in this issue, and it does not work. The example I posted contains local references within the same json schema file. So for z-schema I suppose there is nothing to be resolved. Z-Schema resolving might only work for remote references. However, you end up in both scenarios with a schema containing $ref indicators which are not supported by angular2-schema-form.
from ngx-schema-form.
@ebrehault hello, what about schema's title? As I understand it, now only the description works, right? Are there any plans to add support "title" schema's property as it stated in the standard?
from ngx-schema-form.
Related Issues (20)
- Could not resolve dependency - peer @angular/common@"^11.2.6" from [email protected]
- Parent container for all the form actions HOT 3
- [Bug]: Type mismatch with sf-form component input HOT 1
- Regression loading array data with v 2.7.0
- Visible If not working if value is [0] HOT 3
- Add support for Angular 14 HOT 2
- when adding my angular 14.0.6 project > npm install ngx-schema-form --save HOT 4
- "visibleIf" with nothing vs. "oneOf"
- Support for draft 2020-12 array syntax
- are dependent fields in JSON schema supported ? HOT 2
- visibilityIf no longer works when target is multiple Select widget HOT 2
- Type 'string' is not assignable to type 'TSchemaPropertyType | undefined' HOT 1
- Add support for Angular 15 HOT 3
- Compatibility issue with Angular version 8.2 HOT 5
- Large number input fields behaving oddly HOT 2
- Compatibility with angular 16 HOT 3
- ESM imports not working HOT 1
- undefined type "undefined" error for a valid schema HOT 1
- Issue with visibleIf in array items HOT 4
- upgrade to Angular 17 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-schema-form.