I would like to post an array of strings with min items of 2 and max length of 50 for the strings inside the array.
I set up my swagger like so :
"values":{
"desciption":"values of file",
"type":"array",
"items":{
"type":"string",
"maxLength": 50
},
"minItems": 2
}
but for some reason in the codegen it only takes the minItems without taking into consideration the maxLength I can type 50+ characters and it passes
I find your definition within yml is correct, and even code is not generated correctly. So, I will advise raising a separate bug for this will help other users as well.
Even there are some of the bugs that are not working for example minItems: and maxItems: for the same list doesn't restrict or code is not generating is not automatically for this behavior. #Size(min=2,max=4) i.e.
values:
description: values of file
type: array
items:
type: string
maxLength: 20
minItems: 2
maxItems: 4
So I will suggest you raise a separate bug through the given link:
https://github.com/OpenAPITools/openapi-generator/issues/new?assignees=&labels=Issue%3A+Bug&template=bug_report.md&title=%5BBUG%5D+Description
There are at least two different open issues related to this problem (assuming you want to generate java code):
https://github.com/OpenAPITools/openapi-generator/issues/10026
https://github.com/OpenAPITools/openapi-generator/issues/4947
Even the swagger-api code-generator (https://github.com/swagger-api/swagger-codegen) does have the same issue.
IMHO, everything boils down to a problem with the mustache templates and the underlying java code that can not use BeanValidation 2.0 features like:
https://beanvalidation.org/2.0/spec/#constraintdeclarationvalidationprocess-containerelementconstraints
List<#NotNull #Size(max=20) String> searchTerms
Related
On my process, I have a variable that is an array of objects similar to the following:
"llista-finques" : [
{
"FIN_ID": "H10",
"FIN_NOMBRE": "PLUTO VIVIENDAS",
"FIN_PROPIETARIO": "H10",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H11",
"FIN_NOMBRE": "PLUTO PARKING",
"FIN_PROPIETARIO": "H11",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H12",
"FIN_NOMBRE": "PINTO VIVENDES",
"FIN_PROPIETARIO": "H12",
"FIN_LINIA_NEGOCIO": "Horizontal"
},
{
"FIN_ID": "H16",
"FIN_NOMBRE": "ZURUBANDO",
"FIN_PROPIETARIO": "H16",
"FIN_LINIA_NEGOCIO": "Horizontal"
} ......
I am trying to create a Calculated Propery in one of my forms that needs to create a subset of this array filtering by object property. In order to do so, I was hoping to use the following javascript for the calculated field:
return this.llista-finques.filter(finca => {return finca.FIN_PROPIETARIO === this.Id_client});
For some reason this code produces no result, and after many tests, I have arrived at the conclussion that the variable "this.llista-finques" is simply not accessible from the script, although it is available in the process data.
If I change the Calculated Property script to simply return the value of the variable as bellow:
return this.llista-finques;
or even someting that simply should return a string:
return this.llista-finques[0].FIN_ID
the calculated property produces no result.
If I do exaclty the same with any of the other process variables that are not arrays of objects the calculated property seems to work correctly.
Al the testing I have done is using the screen preview debuging tools of Processmaker 4.
Is there a limitation on the kind of variables I can use for calculated properties? Is this a processmaker bug?
This is embarassing ... after testing and testing and testing I figured out that the problem was due to the name of the variable I was using. Can't use a name with the character '-' ....
Once I corrected the variable name it all worked as expected.
How do I add a term to a listItem in Microsoft Graph API?
For simple String types (ProductSegment in the example) I do the following:
PATCH https://graph.microsoft.com/v1.0/sites/{{sharepoint_site_id}}/lists/{{sharepoint_list_id}}/items/{{num}}/fields
{
"DisplayedName": "asdasfsvsvdvsdbvdfb",
"DocumentType": "FLYER",
"ProductSegment": ["SEG1"],
"TEST_x0020_2_x0020_ProductSegment": [{
"TermGuid": "c252c37d-1fa3-4860-8d3e-ff2cdde1f673"
}],
"Active": true,
"ProductSegment#odata.type": "Collection(Edm.String)",
"TEST_x0020_2_x0020_ProductSegment#odata.type": "Collection(Edm.Term)"
}
Obviously it won't work for TEST_x0020_2_x0020_ProductSegment. But I just cannot find any hints in the documentation.
I got one step closer thanks to the duplicated issue. First I found the name (not the id) of the hidden field TEST 2 ProductSegment_0 (notice the _0 suffix). Then assembled the term value to send: -1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673.
PATCH https://graph.microsoft.com/v1.0/sites/{{sharepoint_site_id}}/lists/{{sharepoint_list_id}}/items/{{num}}/fields
{
"DisplayedName": "asdasfsvsvdvsdbvdfb",
"DocumentType": "FLYER",
"ProductSegment": ["SEG1"],
"i9da5ea20ec548bfb2097f0aefe49df8": "-1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673",
"Active": true,
"ProductSegment#odata.type": "Collection(Edm.String)"
}
and so I can add one item. I would need to add multiple, so I wanted to add the values to an array and set the field type (i9da5ea20ec548bfb2097f0aefe49df8#odata.type) to Collection(Edm.String).
Now I get an error with the code generalException as opposed to an invalidRequest.
As far as I know, graph API does not support updating SharePoint taxonomy. For now, you can go with classic SharePoint REST API for example to accomplish "advanced" things like updating taxonomy terms. Probably a duplicate of: Can't Update Sharepoint Managed Meta Data Field from Microsoft Graph Explorer
Finally I got it.
Thanks #Nikolay for the linked issue.
As I also added this to the end of the question, first you need the name (not the id!) of the hidden field TEST 2 ProductSegment_0 (notice the _0 suffix). Then assemble the term values to send: -1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673 and -1;#SecondLabel|1ef2af46-1fa3-4860-8d3e-ff2cdde1f673, and separate them with ;# (actually the content of the label is irrelevant but some string needs to be there).
Looks utterly ridiculous but works.
PATCH https://graph.microsoft.com/v1.0/sites/{{sharepoint_site_id}}/lists/{{sharepoint_list_id}}/items/{{num}}/fields
{
"DisplayedName": "asdasfsvsvdvsdbvdfb",
"DocumentType": "FLYER",
"ProductSegment": ["SEG1"],
"i9da5ea20ec548bfb2097f0aefe49df8": "-1;#MyLabel|c352c37d-1fa3-4860-8d3e-ff2cdde1f673";#-1;#SecondLabel|1ef2af46-1fa3-4860-8d3e-ff2cdde1f673,
"Active": true,
"ProductSegment#odata.type": "Collection(Edm.String)"
}
I have a list of elements (OData set) and use a binding to show this list.
One field is for a quantity value and this value could sometimes need some decimal places.
The requirement is: only show that amount of decimal numbers that is also available in the OData service.
Annotation techniques can't be used.
I 'hacked' something that is misusing a formatter to update the type of a binding. But this is 'a hack' and it is not possible to convert it to XML views. (The reason is a different handling of the scope the formatter will be called).
So I am searching for a working solution for XML views.
The following code would not work but shows the issue:
new sap.m.Input({ // looking for an XML solution with bindings
value: {
path: "Quantity",
type: new sap.ui.model.type.Float({
// formatOptions
maxFractionDigits: "{QuantityDecimals}",
// ...
}, {
// constraints
minimum: 0
}),
// ...
}
});
The maxFractionDigits : "{QuantityDecimals}" should be "dynamic" and not a constant value.
Setting formatOptions and constraints dynamically in XML (via bindings or a declared function) is unfortunately not (yet) supported. But IMHO this is a valid enhancement request that app developers would greatly benefit from, since it encourages declarative programming.
I already asked for the same feature some years ago but in a comment at https://github.com/SAP/openui5/issues/2449#issuecomment-474304965 (See my answer to Frank's question "If XMLViews would allow a way to specify the dynamic constraints as well (e.g. enhanced syntax), would that fix the problem?").
Please create a new issue via https://github.com/SAP/openui5/issues/new with a clear description of what kind of problems the feature would resolve and possibly other use cases (You can add a link to my comment). I'll add my š to your GitHub issue, and hopefully others too.
I'll update this answer as soon as the feature is available.
Get your dynamic number from your model and store it in a JS variable.
var nQuantityDecimals = this.getModel().getProperty("/QuantityDecimals");
new sap.m.Input({
value : {
path : "Quantity",
type : new sap.ui.model.type.Float({
maxFractionDigits : nQuantityDecimals,
source : {
groupingSeparator: ",",
decimalSeparator: ".",
groupingEnabled: false
}
}, {
minimum:0
})
}
}),
I am using JQuery typeahed from RunningCoder. Typeahead works well if I have few records in my source, but does not work if my source has around 500 records.
It is not related to the result count, which can be managed by maxItem parameter. Also, there is no issue in getting the JSON string from the server, as I can print it without any issue.
I know ideally, I should not have them in my page pre-loaded and search it based on the input, but in my case hitting the server for search is not an option and I want to perform the search from the static data I have in my view. Here is my code:
$.typeahead({
input: "#List .typeahead",
minLength: 3,
templateValue: "{{Text}}",
display: ["Text", "Subtext"],
emptyTemplate: 'No results for "{{query}}"',
template: '<span>' +
'<span class="result" id="{{Value}}">{{Text}}</span>' +
'</span>',
source: {
Issuer: {
data: #Html.Raw(Model.EveryThing)
}
}
});
In my code above if Model.Everything has 40-50 records then it works fine, but does not work for around 500 records.
ADDITIONAL INFO:
After figuring out the issue, would like to explain it a bit as this may help someone. By using above code, you can search the list based on two fields i.e. Text and Subtext, but the user will see only Text in the result and then can select from matching options. This will be very useful if you want to perform the search on more than one field but show just one field.
Figured it out after creating sample data on my own, rather than relying on server response. The issue is not with the length of the result, but null entries in the result.
In my data, there are few objects with Subtext as NULL, and that causes the issue, I fixed it by replacing the NULL with an empty string, and this works as expected now.
Did I miss the link that documents ALL the available uiGridConstants for uiGrid fields in one place? I was working on columnDefs filter and found out EQUAL does not work. That's when I realized there is no central documentation for all the condition constants for uiGridConstants.
columnDefs:
[ { }
, { field: '_pointXID', filter
: {
condition: uiGridConstants.filter.CONTAINS, placeholder: '%PATTERN%'
}, headerCellClass: $scope.whatfilter}
, { field: '_statU16', width: "5%", filter
: {
condition: uiGridConstants.filter.EQUAL, placeholder: '=='
}, headerCellClass: $scope.whatfilter}
, { field: '_valDoub', width: "5%", enableFiltering: false }
]
EQUAL's not one of them, and heck how do I know?!
Looks like I have to open up the source ui-Grid.js to find āuiGridConstants.filter.ā literals in the code. Here it is, my summary for all the ui-gridās available filter conditions in these constants ļØ
1. STARTS_WITH
2. ENDS_WITH
3. CONTAINS
4. EXACT
5. NOT_EQUAL
6. GREATER_THAN
7. GREATER_THAN_OR_EQUAL
8. LESS_THAN
9. LESS_THAN_OR_EQUAL
Have I got all of them or still missed something? (Notice that I canāt locate EQUAL in the source, instead, EXACT!)
You guys are asking of whether there is a default condition. I don't believe there's one, but if your input filter.condition value is not any of the above, your Column filter will return a TRUE which means you have no filters!
So in other words, the default is NO FILTERS : anything goes if your condition constant is not valid
Here be central documentation now
It says:
Used in columnDef.filter to configure filtering on the column
SELECT and INPUT are used with the type property of the filter, the rest are used to specify one of the built-in conditions.
Available condition options are:
uiGridConstants.filter.STARTS_WITH
uiGridConstants.filter.ENDS_WITH
uiGridConstants.filter.CONTAINS
uiGridConstants.filter.GREATER_THAN
uiGridConstants.filter.GREATER_THAN_OR_EQUAL
uiGridConstants.filter.LESS_THAN
uiGridConstants.filter.LESS_THAN_OR_EQUAL
uiGridConstants.filter.NOT_EQUAL
Available type options are:
uiGridConstants.filter.SELECT - use a dropdown box for the cell header filter field
uiGridConstants.filter.INPUT - use a text box for the cell header
filter field