Comments (9)
Hello, I don't know if you have found a fix for this problem.
The model.value array of form send and empty string "" instead of null for fields that are not filled. I've managed to find an workaround for this, for my required fields i'm setting an minLength of one.
from ngx-schema-form.
Hi @raphaelkoszalka. Thank you for this workaround!
We're investigating on this bug but it's nice to have a temporary fix for users
from ngx-schema-form.
@SBats, i've integrated TV4 with angular-2schema-form module, in that way i've managed to properly validate required properties.
If you're interested in the weekend i can open a pull request with that change (tv4 instead of z-scheme for validation).
I just can't do right now because i'll be working untill saturday morning on a project.
from ngx-schema-form.
I must say I don't know yet well the whole module, and at the moment can't say I have an opinion on z-schema vs TV4.
Maybe @fbessou or @ebrehault knows better about this specific point as they chose z-schema?
From my point of view, if the functional scope is not lowered and it fixes bugs, I'm all in! :)
Of course, if you find time to make a PR, we'll be really glad about it! But no rush needed, so take the time you need and don't hesitate to ask questions.
from ngx-schema-form.
Hello there. @raphaelkoszalka, if you have extended the SchemaValidatorFactory class it shouldn't be hard to integrate tv4 in angular2-schema-form.
Currently, the ZSchemaValidatorFactory is hard coded in the FormComponent but it could be provided at module level to allow overriding.
At first, z-schema was chosen because of the set of features it provides and its performances: https://github.com/ebdrup/json-schema-benchmark
from ngx-schema-form.
hey there,
i am also facing the same issue , the minLength workaround works!!
but is it part of the plan to fix this in the future release instead of adding the minLength ??
from ngx-schema-form.
Hi, I am also facing this issue, but I don't like minLength
workaround. z-schema has already support for empty string validation. So I think the best solution is a possibility to inject custom implementation of SchemaValidatorFactory
. I'll try to open a PR for it
from ngx-schema-form.
PR #108
from ngx-schema-form.
A custom SchemalValidatorFactory
can new be defined via module providers.
Example:
...
import {SchemaFormModule, SchemaValidatorFactory, WidgetRegistry} from 'ngx-schema-form';
import {
Custom_FixOptionalEmptyFieldsZSchemaValidatorFactory,
} from './cutsom-validator-factory';
@NgModule({
providers: [
...
{provide: SchemaValidatorFactory, useClass: Custom_FixOptionalEmptyFieldsZSchemaValidatorFactory}
],
declarations: [ ... ],
imports: [ ... ],
bootstrap: [ ... ]
})
export class AppModule {
}
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.