I working on a website that allows users to fill and upload files to a form. This form will be sent to Jira, creating a new ticket. I am doing this integration using Logic Apps, if the user doesn't attach any files, the Logic App works fine, but every time someone adds a file, the file is not added to the ticket but also creates a loop sending loads of emails to the user. Does anyone know how could be done? And if I need to add a function to Azure Function, could someone point me out in the right direction? :)
In the payload, the number 13 is the uploaded files
{
"inputs": {
"content": "#body('HTTP')",
"schema": {
"properties": {
"1": {
"type": "string"
},
"2": {
"type": "string"
},
"3": {
"type": "string"
},
"4": {
"type": "string"
},
"5": {
"type": "string"
},
"6": {
"type": "string"
},
"7": {
"type": "string"
},
"8": {
"type": "string"
},
"9": {
"type": "string"
},
"10": {
"type": "string"
},
"11": {
"type": "string"
},
"12": {
"type": "string"
},
"13": {
"items": {
"type": "string"
},
"type": "array"
},
"14.1": {
"type": "string"
},
"14.2": {
"type": "string"
},
"14.3": {
"type": "string"
},
"created_by": {
"type": [
"string",
"null"
]
},
"currency": {
"type": "string"
},
"date_created": {
"type": "string"
},
"date_updated": {
"type": "string"
},
"form_id": {
"type": "string"
},
"id": {
"type": "string"
},
"ip": {
"type": "string"
},
"is_fulfilled": {},
"is_read": {
"type": "string"
},
"is_starred": {
"type": "string"
},
"payment_amount": {},
"payment_date": {},
"payment_method": {},
"payment_status": {},
"post_id": {},
"source_url": {
"type": "string"
},
"status": {
"type": "string"
},
"transaction_id": {},
"transaction_type": {},
"user_agent": {
"type": "string"
}
},
"type": "object"
}
}
}
Related
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Title",
"type": "object",
"properties": {
"location": {
"type": "string"
},
"dagno": {
"type": "string"
},
"pattano": {
"type": "string"
},
"pattatype": {
"type": "string"
},
"landclass": {
"type": "string"
},
"bigha": {
"type": "string"
},
"katha": {
"type": "string"
},
"lessa": {
"type": "string"
},
"pid": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"pdarid": {
"type": "string"
},
"pdarname": {
"type": "string"
},
"pdarfather": {
"type": "string"
}
},
"required": [
"pdarid",
"pdarname",
"pdarfather"
]
}
]
}
},
"required": [
"location",
"dagno",
"pattano",
"pattatype",
"landclass",
"bigha",
"katha",
"lessa",
"pid"
]
}
I'm getting these error messages in logs:
[12:15 11:48:20.957] [ERROR][request id: ffdedde3-f147-4fc2-9f9f-ad0c76c1a868][springfox.documentation.swagger2.mappers.ReferenceModelSpecificationToPropertyConverter] - Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.lang', name='Class�ConstraintValidator�object,object��'}, viewDiscriminator=com.test.entity.view.View$External, validationGroupDiscriminators=[], isResponse=true}
[12:15 11:48:20.957] [ERROR][request id: ffdedde3-f147-4fc2-9f9f-ad0c76c1a868][springfox.documentation.swagger2.mappers.ReferenceModelSpecificationToPropertyConverter] - Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.lang', name='Class�object�'}, viewDiscriminator=com.test.entity.view.View$External, validationGroupDiscriminators=[], isResponse=true}
[12:15 11:48:20.958] [ERROR][request id: ffdedde3-f147-4fc2-9f9f-ad0c76c1a868][springfox.documentation.swagger2.mappers.ReferenceModelSpecificationToPropertyConverter] - Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.lang', name='Class�Payload�'}, viewDiscriminator=com.test.entity.view.View$External, validationGroupDiscriminators=[], isResponse=true}
[12:15 11:48:20.991] [ERROR][request id: ffdedde3-f147-4fc2-9f9f-ad0c76c1a868][springfox.documentation.swagger2.mappers.ReferenceModelSpecificationToPropertyConverter] - Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.lang', name='Class�ConstraintValidator�object,object��'}, viewDiscriminator=null, validationGroupDiscriminators=[], isResponse=true}
[12:15 11:48:20.991] [ERROR][request id: ffdedde3-f147-4fc2-9f9f-ad0c76c1a868][springfox.documentation.swagger2.mappers.ReferenceModelSpecificationToPropertyConverter] - Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.lang', name='Class�object�'}, viewDiscriminator=null, validationGroupDiscriminators=[], isResponse=true}
[12:15 11:48:20.992] [ERROR][request id: ffdedde3-f147-4fc2-9f9f-ad0c76c1a868][springfox.documentation.swagger2.mappers.ReferenceModelSpecificationToPropertyConverter] - Unable to find a model that matches key ModelKey{qualifiedModelName=ModelName{namespace='java.lang', name='Class�Payload�'}, viewDiscriminator=null, validationGroupDiscriminators=[], isResponse=true}
It seems as custom validation annotations are somehow involved and related to them fields are treated as models or smth.
Example:
#Target({ElementType.TYPE})
#Retention(RetentionPolicy.RUNTIME)
#Constraint(validatedBy = CardDocumentValidator.class)
#Documented
public #interface CardDocument {
String message();
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
public class CardDocumentValidator implements ConstraintValidator<CardDocument, TestEntity> {...}
I'm using Spring Boot 2.5.5 with springfox-boot-starter 3.0.0.
However I'm still on OpenApi 2.0, so I have configured the property springfox:documentation:swagger:use-model-v3: false, which helped me to get rid of similar errors.
In api-docs json among definitions:
"ConstraintDescriptor«object»": {
"type": "object",
"properties": {
"annotation": {
"type": "object"
},
"attributes": {
"type": "object"
},
"composingConstraints": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/ConstraintDescriptor«object»"
}
},
"constraintValidatorClasses": {
"type": "array",
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«ConstraintValidator«object,object»»'}"
}
},
"groups": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«object»'}"
}
},
"messageTemplate": {
"type": "string"
},
"payload": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«Payload»'}"
}
},
"reportAsSingleViolation": {
"type": "boolean"
},
"validationAppliesTo": {
"type": "string",
"enum": [
"IMPLICIT",
"PARAMETERS",
"RETURN_VALUE"
]
},
"valueUnwrapping": {
"type": "string",
"enum": [
"DEFAULT",
"SKIP",
"UNWRAP"
]
}
},
"title": "ConstraintDescriptor«object»"
},
"ConstraintDescriptor«object»DefaultView": {
"type": "object",
"properties": {
"annotation": {
"type": "object"
},
"attributes": {
"type": "object"
},
"composingConstraints": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/ConstraintDescriptor«object»DefaultView"
}
},
"constraintValidatorClasses": {
"type": "array",
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«ConstraintValidator«object,object»»'}"
}
},
"groups": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«object»'}"
}
},
"messageTemplate": {
"type": "string"
},
"payload": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«Payload»'}"
}
},
"reportAsSingleViolation": {
"type": "boolean"
},
"validationAppliesTo": {
"type": "string",
"enum": [
"IMPLICIT",
"PARAMETERS",
"RETURN_VALUE"
]
},
"valueUnwrapping": {
"type": "string",
"enum": [
"DEFAULT",
"SKIP",
"UNWRAP"
]
}
},
"title": "ConstraintDescriptor«object»DefaultView"
},
"ConstraintDescriptor«object»ExternalView": {
"type": "object",
"properties": {
"annotation": {
"type": "object"
},
"attributes": {
"type": "object"
},
"composingConstraints": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/ConstraintDescriptor«object»ExternalView"
}
},
"constraintValidatorClasses": {
"type": "array",
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«ConstraintValidator«object,object»»'}"
}
},
"groups": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«object»'}"
}
},
"messageTemplate": {
"type": "string"
},
"payload": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Error-ModelName{namespace='java.lang', name='Class«Payload»'}"
}
},
"reportAsSingleViolation": {
"type": "boolean"
},
"validationAppliesTo": {
"type": "string",
"enum": [
"IMPLICIT",
"PARAMETERS",
"RETURN_VALUE"
]
},
"valueUnwrapping": {
"type": "string",
"enum": [
"DEFAULT",
"SKIP",
"UNWRAP"
]
}
},
"title": "ConstraintDescriptor«object»ExternalView"
},
"ConstraintValidator«object,object»": {
"type": "object",
"title": "ConstraintValidator«object,object»"
},
"ConstraintValidator«object,object»DefaultView": {
"type": "object",
"title": "ConstraintValidator«object,object»DefaultView"
},
"ConstraintValidator«object,object»ExternalView": {
"type": "object",
"title": "ConstraintValidator«object,object»ExternalView"
},
"ConstraintViolation": {
"type": "object",
"properties": {
"constraintDescriptor": {
"$ref": "#/definitions/ConstraintDescriptor«object»"
},
"executableParameters": {
"type": "array",
"items": {
"type": "object"
}
},
"executableReturnValue": {
"type": "object"
},
"invalidValue": {
"type": "object"
},
"leafBean": {
"type": "object"
},
"message": {
"type": "string"
},
"messageTemplate": {
"type": "string"
},
"propertyPath": {
"$ref": "#/definitions/Path"
},
"rootBean": {
"type": "object"
}
},
"title": "ConstraintViolation"
},
"ConstraintViolationDefaultView": {
"type": "object",
"properties": {
"constraintDescriptor": {
"$ref": "#/definitions/ConstraintDescriptor«object»DefaultView"
},
"executableParameters": {
"type": "array",
"items": {
"type": "object"
}
},
"executableReturnValue": {
"type": "object"
},
"invalidValue": {
"type": "object"
},
"leafBean": {
"type": "object"
},
"message": {
"type": "string"
},
"messageTemplate": {
"type": "string"
},
"propertyPath": {
"$ref": "#/definitions/PathDefaultView"
},
"rootBean": {
"type": "object"
}
},
"title": "ConstraintViolationDefaultView"
},
"ConstraintViolationExternalView": {
"type": "object",
"properties": {
"constraintDescriptor": {
"$ref": "#/definitions/ConstraintDescriptor«object»ExternalView"
},
"executableParameters": {
"type": "array",
"items": {
"type": "object"
}
},
"executableReturnValue": {
"type": "object"
},
"invalidValue": {
"type": "object"
},
"leafBean": {
"type": "object"
},
"message": {
"type": "string"
},
"messageTemplate": {
"type": "string"
},
"propertyPath": {
"$ref": "#/definitions/PathExternalView"
},
"rootBean": {
"type": "object"
}
},
"title": "ConstraintViolationExternalView"
},
Found the culprit :)
private Set validationErrors in one of the base entity classes.
So ConstraintViolation was added to Models and ConstraintDescriptor and its fields' classes which included:
private final List<Class<? extends ConstraintValidator<T, ?>>> constraintValidatorClasses;
private final Set<Class<?>> groups;
private final Set<Class<? extends Payload>> payloads;
Putting #JsonIgnore helped. Another way is to add #ApiModelProperty(hidden = true) which doesn't affect serialization by simply hiding the field from being documented.
as per title.
Whilst dealing with my own mailbox is fine I wish to ideally process a shared mailbox in LogicApps. I can read the emails but I want to clean-up by deleting the messages.
Logic Apps doesn't seem to offer that action and unless mistaken the graph api doesnt either?
Has anyone managed this?
This has been possible since the update on 6th May 2020. A number of the actions now support an Original Mailbox Address optional parameter that you can set to access the shared mailbox:
As of May 6, 2020, shared mailbox support was added for certain operations with an optional 'Mailbox address' parameter, allowing you to specify a shared mailbox address for your operation to access.
The Delete Email (V2) action supports this parameter:
You then fill in the email address of your shared mailbox:
Which will then successfully find your message id and delete the email for you:
For this requirement, I write a logic app sample for your reference:
Before we start, provide the whole logic app:
1. In first "HTTP" action, I request for the access token.
2. Then I add a "Parse JSON" action to parse the response from the first "HTTP" action to get the access token.
The schema should be:
{
"properties": {
"access_token": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"ext_expires_in": {
"type": "integer"
},
"token_type": {
"type": "string"
}
},
"type": "object"
}
3. In the second "HTTP" action, I request for all of the messages by the access token from above steps.
4. After that, we need to use another "Parse JSON" action to parse the response from "HTTP 2".
The schema should be:
{
"properties": {
"##odata.context": {
"type": "string"
},
"value": {
"items": {
"properties": {
"##odata.etag": {
"type": "string"
},
"bccRecipients": {
"type": "array"
},
"body": {
"properties": {
"content": {
"type": "string"
},
"contentType": {
"type": "string"
}
},
"type": "object"
},
"bodyPreview": {
"type": "string"
},
"categories": {
"type": "array"
},
"ccRecipients": {
"type": "array"
},
"changeKey": {
"type": "string"
},
"conversationId": {
"type": "string"
},
"conversationIndex": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"flag": {
"properties": {
"flagStatus": {
"type": "string"
}
},
"type": "object"
},
"from": {
"properties": {
"emailAddress": {
"properties": {
"address": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"hasAttachments": {
"type": "boolean"
},
"id": {
"type": "string"
},
"importance": {
"type": "string"
},
"inferenceClassification": {
"type": "string"
},
"internetMessageId": {
"type": "string"
},
"isDeliveryReceiptRequested": {
"type": "boolean"
},
"isDraft": {
"type": "boolean"
},
"isRead": {
"type": "boolean"
},
"isReadReceiptRequested": {
"type": "boolean"
},
"lastModifiedDateTime": {
"type": "string"
},
"parentFolderId": {
"type": "string"
},
"receivedDateTime": {
"type": "string"
},
"replyTo": {
"type": "array"
},
"sender": {
"properties": {
"emailAddress": {
"properties": {
"address": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"sentDateTime": {
"type": "string"
},
"subject": {
"type": "string"
},
"toRecipients": {
"items": {
"properties": {
"emailAddress": {
"properties": {
"address": {
"type": "string"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"emailAddress"
],
"type": "object"
},
"type": "array"
},
"webLink": {
"type": "string"
}
},
"required": [
"##odata.etag",
"id",
"createdDateTime",
"lastModifiedDateTime",
"changeKey",
"categories",
"receivedDateTime",
"sentDateTime",
"hasAttachments",
"internetMessageId",
"subject",
"bodyPreview",
"importance",
"parentFolderId",
"conversationId",
"conversationIndex",
"isDeliveryReceiptRequested",
"isReadReceiptRequested",
"isRead",
"isDraft",
"webLink",
"inferenceClassification",
"body",
"sender",
"from",
"toRecipients",
"ccRecipients",
"bccRecipients",
"replyTo",
"flag"
],
"type": "object"
},
"type": "array"
}
},
"type": "object"
}
5. Then use a "For each" and loop the value from "Parse JSON 2".
6. In "For each", we need to add third "HTTP" action as below screenshot:
7. Run the logic app, it will delete all of the messages in shared mailbox.
By the way:
Before run the logic app, you need to search the client_id in your azure ad app registrations to find the application and add the Mail.ReadWrite permission to it. Also don't forget grant admin consent for it.
I am using restAssured for my json schema validation.
Below is my script for assertion:
String JsonString = response.asString();
Assert.assertEquals(JsonString,matchesJsonSchemaInClasspath("quotesschema.json"));
And I have placed my quotesschema.json file in project/bin folder.
When I run my test script, assertion fails with below message
java.lang.AssertionError: expected [] but found [actual api response]
Also, I validated my schema against api response thru http://json-schema-validator.herokuapp.com/ schema validator.
Not sure whether its reading my schema inside the .son file.
Below is my schema.
{
"type": "object",
"$schema": "http://json-schema.org/draft-03/schema",
"title": "quotes-schema",
"description": "JSON Schema for Quotes",
"properties": {
"result": {
"type": "object",
"properties": {
"Quotes": {
"type": "array",
"properties": {
"DisplaySymbol": {
"type": "string"
},
"Identifier": {
"type": "string"
},
"Exchange": {
"type": "string"
},
"Trade": {
"type": "string"
},
"Date": {
"type": "string"
},
"Change": {
"type": "string"
},
"Bid": {
"type": "string"
},
"BidSize": {
"type": "string"
},
"Ask": {
"type": "string"
},
"AskSize": {
"type": "string"
},
"High": {
"type": "string"
},
"Low": {
"type": "string"
},
"Volume": {
"type": "string"
},
"Open": {
"type": "string"
},
"PreviousClose": {
"type": "string"
},
"High52Week": {
"type": "string"
},
"High52WeekDate": {
"type": "string"
},
"Low52Week": {
"type": "string"
},
"Low52WeekDate": {
"type": "string"
},
"PERatio": {
"type": "string"
},
"MarketCap": {
"type": "string"
},
"SharesOutstanding": {
"type": "string"
},
"RollingEPS": {
"type": "string"
},
"IsDefault": {
"type": "string"
},
"IsIndex": {
"type": "string"
},
"Class": {
"type": "string"
}
}
}
}
}
}
}
matchesJsonSchemaInClasspath method returns JsonSchemaValidator class and not a String.
That's why your Assert will not work, where strings are compared:
JsonString = response.asString();
Assert.assertEquals(JsonString,matchesJsonSchemaInClasspath("quotesschema.json"));
Actual usage be inside body() method as explained below:
get("RESTPATH").then().assertThat().body(matchesJsonSchemaInClasspath("quotesschema.json"));
I'm using Elasticsearch and create an index with the following information for mapping and settings. The problem I have is that my field geography.locality which should use the 'name_analyser' doesn't seem to use it.
{
"index": "programs",
"body": {
"settings": {
"number_of_shards": 5,
"analysis": {
"filter": {
"elision": {
"type": "elision",
"articles": [
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d"
]
},
"multi_words": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 10
},
"name_filter": {
"type": "edgeNGram",
"max_gram": 100,
"min_gram": 2
}
},
"tokenizer": {
"name_tokenizer": {
"type": "edgeNGram",
"max_gram": 100,
"min_gram": 2
}
},
"analyser": {
"name_analyser": { // <-- analyser I want to use on geography.locality
"tokenizer": "whitespace",
"type": "custom",
"filter": [
"lowercase",
"multi_words",
"name_filter",
"asciifolding"
]
},
"french": {
"tokenizer": "letter",
"filter": [
"asciifolding",
"lowercase",
"elision",
"stop"
]
},
"city_name": {
"type": "custom",
"tokenizer": "letter",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}
},
"mappings": {
"program": {
"properties": {
"nid": {
"type": "integer",
"index": "not_analyzed"
},
"title": {
"type": "string"
},
"language": {
"type": "string",
"index": "not_analyzed"
},
"regulation": {
"type": "integer"
},
"sales_state": {
"type": "integer"
},
"enabled_dwell": {
"type": "boolean"
},
"enabled_invest": {
"type": "boolean"
},
"delivery_date": {
"type": "date"
},
"address": {
"properties": {
"country": {
"type": "string",
"index": "not_analyzed"
},
"locality": {
"type": "string",
"analyser": "name_analyser"
},
"postal_code": {
"type": "integer"
},
"thoroughfare": {
"type": "string",
"index": "not_analyzed"
},
"premise": {
"type": "string",
"index": "not_analyzed"
}
}
},
"location": {
"type": "geo_point"
},
"geography": {
"properties": {
"locality": {
"type": "string",
"analyser": "name_analyser" // ... here :-/
},
"department": {
"type": "string",
"index": "not_analyzed"
},
"region": {
"type": "string",
"index": "not_analyzed"
}
}
},
"lots": {
"type": "nested",
"include_in_all": false,
"properties": {
"lot_type": {
"type": "integer"
},
"rooms": {
"type": "integer"
},
"price_vat_inc": {
"type": "integer"
},
"price_reduced_vat_inc": {
"type": "integer"
},
"price_vat_ex": {
"type": "integer"
}
}
}
}
}
}
}
}
Here's the output given by ES for the mapping registered for this index.
{
"program": {
"properties": {
"address": {
"properties": {
"country": {
"index": "not_analyzed",
"type": "string"
},
"premise": {
"index": "not_analyzed",
"type": "string"
},
"locality": {
"type": "string"
},
"postal_code": {
"type": "integer"
},
"thoroughfare": {
"index": "not_analyzed",
"type": "string"
}
}
},
"sales_state": {
"type": "integer"
},
"nid": {
"type": "integer"
},
"language": {
"index": "not_analyzed",
"type": "string"
},
"title": {
"type": "string"
},
"enabled_invest": {
"type": "boolean"
},
"geo_point": {
"type": "string"
},
"lots": {
"include_in_all": false,
"type": "nested",
"properties": {
"rooms": {
"include_in_all": false,
"type": "integer"
},
"price_vat_inc": {
"include_in_all": false,
"type": "integer"
},
"price_vat_ex": {
"include_in_all": false,
"type": "integer"
},
"lot_type": {
"include_in_all": false,
"type": "integer"
},
"price_reduced_vat_inc": {
"include_in_all": false,
"type": "integer"
}
}
},
"enabled_dwell": {
"type": "boolean"
},
"delivery_date": {
"format": "dateOptionalTime",
"type": "date"
},
"regulation": {
"type": "integer"
},
"geography": {
"properties": {
"locality": {
"type": "string" // name_analyser should show up here right?????
},
"department": {
"index": "not_analyzed",
"type": "string"
},
"region": {
"index": "not_analyzed",
"type": "string"
}
}
},
"location": {
"type": "geo_point"
}
}
}
}
Does anybody knows what I am doing wrong? I'm kind of lost about this.
You have a typo :-), actually two:
"locality": {
"type": "string",
"analyser": "name_analyser"
},
in both address and geography. It should be analyzer not analyser (with an s).
Also, the same here:
"analyser": {
"name_analyser": {
"tokenizer": "whitespace",
...
I am guessing that the index exists and you are trying to update the settings with a new analyser. This is not permitted on a live index.
Do you have any errors when you submit the updated settings?
Have a look at this thread - Change settings and mappings on existing index in Elasticsearch
and here http://www.elastic.co/guide/en/elasticsearch/reference/1.x/indices-update-settings.html#update-settings-analysis