How to write a custom pattern validator in Angular Dart 2 - dart

How to write a custom validator in Angular Dart 2. Is there a working example of a validator with parameters and how to use it ?

You can see the pattern validator here: https://github.com/dart-lang/angular/blob/706c1b634443cfe2ba60b6ab37e2a536078ed00a/angular_forms/lib/src/directives/validators.dart#L165

Related

Generating domain model classes from swagger with Autorest

I'm trying to use Autorests own example to generate a client.
https://github.com/Azure/autorest/blob/main/docs/generate/readme.md
And when I run
autorest --input-file=pets.json --csharp
I get a Client class and an Options class. But it does not generate the Dog or Kitten classes for me, eventhough I can see the they are defined the pets.json file.
What am I missing here?
autorest --input-file=pets.json --csharp --generation1-convenience-client
seemed to be the answer :)

Can I define new mustache template variables in swagger-codegen?

I have developed a rest-api client (in java) customised to the needs of my product. I wanted to generate tests using my rest api client using swagger-codegen modules based on yaml-file.
I have already extended DefaultCodegenConfig & even tried implementing the CodegenConfig interface to build my custom jar. I have customized the api.mustache and api_test.mustache files and passing them in the constructor and processOpts() method of my CustomCodeGen that extends DefaultCodegenConfig.
However, I want to use the custom/new mustache template variables that I have added in my customised api.mustache.
For e.g. if refer to standard api.mustache, the template variables it typically uses are
- {{classname}}
- {{#operation}}
- {{#contents}}
- {{#parameters}}
etc.
Now, I want to introduce a new template variable, let's say {{custom_param}}. Now I am not clear how do I integrate this new template variable with the implementation.
Looks like from this Mustache-Template-Variables published here, swagger-codegen does not allow adding new template-variables and perhaps we are restricted to only the variables mentioned on this page.
So, is there some way to make the new template variables work ?
Some time ago I added the uniqueItems parameter for bean validation as it was not getting processed by the engine even though it was a part of the implemented JSR.
So I believe codebase needs to be updated to use your own variable which is only possible if you fork the code.
In case it helps, these two were the PRs:
For query parameters: https://github.com/swagger-api/swagger-codegen/pull/10154.
For body parameters: https://github.com/swagger-api/swagger-codegen/pull/10490.

syncfusion error render chart convert void to object

This is my first time use syncfusion for asp mvc 5 razor
I want to create a chart, in my learning i found error in my first.
#(Html.EJ().Chart("container").Render())
that is my code in cshtml and this is my error :
Cannot implicitly convert type 'void' to 'object'
how to solve this?
This happens because of specifying the “.Render()”
This structure was followed in Syncfusion Essential studio version 12.1.0.36. But it was changed in the future release.
Please find the below code snippet for initializing a chart control.
[CSHTML]
#(Html.EJ().Chart("container"))
This standard is followed from Syncfusion Essential studio version 12.2.0.36 to current versions.
Thanks,
The parenthesis used in Html helper (#(Html.EJ) defines an explicit expression and the curly brackets(#{Html.EJ) defines a regular C# code block. The difference is that the explicit expression submits its output directly as a part of the HTML mark up and the code block doesn't.
And so if you want to use Render then use your code within the code block ({}).
#{ Html.EJ()
…
.Render()}

Can I add Dart Web UI bindings to DOM elements created in code?

In the Dart Web UI package, it is possible to create bindings using the {{}} or bind-value syntax. Is this also possible, when DOM elements are created in code?
Something like
new Element.html('<div>Value: {{str}}</div>');
and
new Element.html('<input type="text" bind-value="str">');
binding an event to str, without manually piecing the strings together?
Note: this question was asked earlier today, but was deleted before it was answered, but I wanted to know the answer, so I'm reposting it.
Quick answer, no.
The bindings need to be processed by the dwc transformer, which converts Web Components and MDV code into "vanilla" Dart and HTML (suitable for compilation to "vanilla" JavaScript).
Generally, you should use <template> tags to instantiate new elements.
An alternative is to wrap these bits of text inside a custom element, which you can transform with dwc and instantiate manually.

GXT 3.x Custom PropertyEditor / ValueBaseInputCell

I'm trying to write a custom field editor that will translate between Long and String. IE: String representation on screen but field type is a Long.
I've implemented the PropertyEditor (HrMinPropertyEditor) but don't know how to wire it in. My HrMinField is quite clunky as I needed to use a TriggerFieldCell because the generic types inside TextInputCell etc. prevented me from using them.
Do I need to do a subclass of ValueBaseInputCell? That seems strange since my PropertyEditor has all the Long / String conversions. It also looks difficult.
If so, is there a simple example or some documentation I can read?
BTW, my learning project is Maven based and should be easy to fire up if necessary:
svn checkout http://subversion.assembla.com/svn/freshcode_public/learn/gwt/ learn-gwt
cd learn-gwt
mvn gwt:run
Navigate to GXT | Forms | Time Edit
Thanks in advance,
Pete
PS: I've asked this on the Sencha forum too.
You should use method setPropertyEditor from Field class to specify your custom property editor:
HrMinField f = new HrMinField();
f.setPropertyEditor( new HrMinPropertyEditor() );
I managed to come up with a solution using a Converter and a Validator.
The more complete answer is on the Sencha thread.

Resources