Odata PageResult response property names are changed after upgrading to 8.0.11 for NET 3.1 to NET 6.0 migration - odata

Have below code to generate page result to get below expected result but i am getting below current result. Client using this end point is breaking as there are no items,nextpagelink and count available after upgrading the framework to net6 and odata to 8.0.11
Expected Result :
{
"items": [
{"id":6975,"name":"Dummy Value","phone":"999999999","fax":null,"address":"Dummy street","city":"Some","state":"some","zipCode":"99999","countryId":1}],
"nextPageLink":"/Vendors?$filter=zipCode%20eq%20%2785022%27&$orderby=name%20asc&$skip=50",
"count":null
}
Current Result :
{
"#odata.context": "http://localhost:8080/$metadata#Vendors",
"value":
[
{
"id": 6975,
"name": "Dummy Value",
"phone": "999999999",
"fax": null,
"address": "Dummy",
"city": "Some",
"state": "Some",
"zipCode": "99999",
"countryId": 1
}
],
"#odata.nextLink": "/Vendors?$filter=zipCode%20eq%20%2799999%27&$orderby=name%20asc&$skip=50"
Controller Code:
Start up.cs :
Expected Result :
{
"items": [
{"id":6975,"name":"Dummy Value","phone":"999999999","fax":null,"address":"Dummy street","city":"Some","state":"some","zipCode":"99999","countryId":1}],
"nextPageLink":"/Vendors?$filter=zipCode%20eq%20%2785022%27&$orderby=name%20asc&$skip=50",
"count":null
}
Current Result :
{
"#odata.context": "http://localhost:8080/$metadata#Vendors",
"value":
[
{
"id": 6975,
"name": "Dummy Value",
"phone": "999999999",
"fax": null,
"address": "Dummy",
"city": "Some",
"state": "Some",
"zipCode": "99999",
"countryId": 1
}
],
"#odata.nextLink": "/Vendors?$filter=zipCode%20eq%20%2799999%27&$orderby=name%20asc&$skip=50"

Related

My EF Core 6 OData endpoint is returning whole infrastructure instead of model?

My EF Core application is returning what I imagine is context information in response instead of model. When calling the endpoint with expand option. This is the result returned:
{
"$id": "1",
"instance": null,
"container": {
"$id": "2",
"name": "SurveyQuestionValidations",
"value": null,
"next0": {
"$id": "3",
"name": "Id",
"value": 1,
"autoSelected": true
},
"autoSelected": false
},
"model": {
"$id": "4",
"schemaElements": [
{
"$id": "5",
"declaredKey": [
{
"$id": "6",
"defaultValueString": null,
"propertyKind": 1,
"type": {
"isNullable": false,
"definition": {
"$id": "7",
"name": "Int32",
"namespace": "Edm",
"typeKind": 1,
"primitiveKind": 9,
"schemaElementKind": 1,
"fullName": "Edm.Int32"
}
},
"declaringType": {
"$ref": "5"
},
"name": "Id"
}
],
"schemaElementKind": 1,
"namespace": "Data.Models",
"name": "SurveyQuestion",
"fullName": "Data.ModelsSurveyQuestion",
"typeKind": 2,
"hasStream": false,
"isAbstract": false,
"isOpen": false,
"declaredProperties": [ ...etc
This only happens when using expand. And the query is really slow but I believe it is related.

No Type Error when trying to transform JSON to AVRO

I'm trying to convert a JSON payload to Avro to publish to a Kafka topic. However, when I do the Dataweave transformation I'm getting a "No Type" error. I'm not sure what's causing the error. I originally thought this might be due to the transformation not knowing what the MIME type on the inbound payload. So, I've made sure that it's set to application/json but that didn't make any difference.
Avro Schema
{
"compatibility" : "forward",
"name": "ContentManagerCoupons",
"type": "record",
"namespace": "com.rentpath",
"fields": [
{
"name": "clientID",
"type": "string"
},
{
"name": "outputHistoryId",
"type": "string"
},
{
"name": "categoryCoupons",
"type": {
"type": "array",
"items": {
"name": "categoryCoupons_record",
"type": "record",
"fields": [
{
"name": "applyBy",
"type": [
"string",
"int",
"null"
]
},
{
"name": "applyPeriod",
"type": [
"string",
"null"
]
},
{
"name": "cashValue",
"type": [
"int",
"null"
]
},
{
"name": "couponCategory",
"type": "string"
},
{
"name": "cashOffDesc",
"type": [
"string",
"null"
]
},
{
"name": "endDate",
"type": [
"string",
"null"
]
},
{
"name": "feeType",
"type": [
"string",
"null"
]
},
{
"name": "freeWeeks",
"type": [
"string",
"null"
]
},
{
"name": "generatedText",
"type": "string"
},
{
"name": "leaseby",
"type": [
"string",
"null"
]
},
{
"name": "leaseTerm",
"type": [
"int",
"null"
]
},
{
"name": "offerText",
"type": [
"string",
"null"
]
},
{
"name": "startDate",
"type": "string"
},
{
"name": "unitType",
"type": [
"string",
"null"
]
}
]
}
}
}
]
}
JSON Message
{
"outputHistoryId": "55324456",
"clientID": "112345",
"categoryCoupons": [
{
"unitType": null,
"startDate": "07/21/2020",
"offerText": "This would be the special offer message.",
"leaseTerm": null,
"leaseby": null,
"generatedText": "This would be the special offer message..",
"freeWeeks": null,
"feeType": null,
"endDate": "10/01/2020",
"couponCategory": "Special Offer",
"cashValue": null,
"cashOffDesc": null,
"applyPeriod": null,
"applyBy": null
}
]
}
Datawave
%dw 2.2
output application/avro schemaUrl="http://schema-registry.domain.com:8081/subjects/Coupon-value/versions/1"
---
payload
Error Message
"org.apache.avro.SchemaParseException - No type: {"subject":"ContentManager.Coupon-value","version":1,"id":342,"schema":"{"type":"record","name":"ContentManagerCoupons","namespace":"com.rentpath","fields":[{"name":"clientID","type":"string"},{"name":"outputHistoryId","type":"string"},{"name":"categoryCoupons","type":{"type":"array","items":{"type":"record","name":"categoryCoupons_record","fields":[{"name":"applyBy","type":["string","int","null"]},{"name":"applyPeriod","type":["string","null"]},{"name":"cashValue","type":["int","null"]},{"name":"couponCategory","type":"string"},{"name":"cashOffDesc","type":["string","null"]},{"name":"endDate","type":["string","null"]},{"name":"feeType","type":["string","null"]},{"name":"freeWeeks","type":["string","null"]},{"name":"generatedText","type":"string"},{"name":"leaseby","type":["string","null"]},{"name":"leaseTerm","type":["int","null"]},{"name":"offerText","type":["string","null"]},{"name":"startDate","type":"string"},{"name":"unitType","type":["string","null"]}]}}}],"compatibility":"forward"}"}
org.apache.avro.SchemaParseException: No type: {"subject":"ContentManager.Coupon-value","version":1,"id":342,"schema":"{"type":"record","name":"ContentManagerCoupons","namespace":"com.rentpath","fields":[{"name":"clientID","type":"string"},{"name":"outputHistoryId","type":"string"},{"name":"categoryCoupons","type":{"type":"array","items":{"type":"record","name":"categoryCoupons_record","fields":[{"name":"applyBy","type":["string","int","null"]},{"name":"applyPeriod","type":["string","null"]},{"name":"cashValue","type":["int","null"]},{"name":"couponCategory","type":"string"},{"name":"cashOffDesc","type":["string","null"]},{"name":"endDate","type":["string","null"]},{"name":"feeType","type":["string","null"]},{"name":"freeWeeks","type":["string","null"]},{"name":"generatedText","type":"string"},{"name":"leaseby","type":["string","null"]},{"name":"leaseTerm","type":["int","null"]},{"name":"offerText","type":["string","null"]},{"name":"startDate","type":"string"},{"name":"unitType","type":["string","null"]}]}}}],"compatibility":"forward"}"}
at org.apache.avro.Schema.getRequiredText(Schema.java:1753)
at org.apache.avro.Schema.parse(Schema.java:1604)
at org.apache.avro.Schema$Parser.parse(Schema.java:1394)
at org.apache.avro.Schema$Parser.parse(Schema.java:1365)
at org.mule.weave.v2.module.avro.AvroWriter.doWriteValue(AvroWriter.scala:195)
at org.mule.weave.v2.module.writer.Writer.writeValue(Writer.scala:41)
at org.mule.weave.v2.module.writer.Writer.writeValue$(Writer.scala:39)
at org.mule.weave.v2.module.avro.AvroWriter.writeValue(AvroWriter.scala:44)
at org.mule.weave.v2.module.writer.DeferredWriter.doWriteValue(DeferredWriter.scala:73)
at org.mule.weave.v2.module.writer.Writer.writeValue(Writer.scala:41)
at org.mule.weave.v2.module.writer.Writer.writeValue$(Writer.scala:39)
at org.mule.weave.v2.module.writer.DeferredWriter.writeValue(DeferredWriter.scala:16)
at org.mule.weave.v2.module.writer.WriterHelper$.writeValue(Writer.scala:120)
at org.mule.weave.v2.module.writer.WriterHelper$.writeAndGetResult(Writer.scala:98)
at org.mule.weave.v2.interpreted.InterpretedMappingExecutableWeave.write(InterpreterMappingCompilerPhase.scala:236)
at org.mule.weave.v2.el.WeaveExpressionLanguageSession.evaluateWithTimeout(WeaveExpressionLanguageSession.scala:243)
at org.mule.weave.v2.el.WeaveExpressionLanguageSession.evaluate(WeaveExpressionLanguageSession.scala:108)
at org.mule.runtime.core.internal.el.dataweave.DataWeaveExpressionLanguageAdaptor$1.evaluate(DataWeaveExpressionLanguageAdaptor.java:308)
at org.mule.runtime.core.internal.el.DefaultExpressionManagerSession.evaluate(DefaultExpressionManagerSession.java:105)
at com.mulesoft.mule.runtime.core.internal.processor.SetPayloadTransformationTarget.process(SetPayloadTransformationTarget.java:32)
at com.mulesoft.mule.runtime.core.internal.processor.TransformMessageProcessor.lambda$0(TransformMessageProcessor.java:92)
at java.util.Optional.ifPresent(Optional.java:159)
at com.mulesoft.mule.runtime.core.internal.processor.TransformMessageProcessor.process(TransformMessageProcessor.java:92)
at org.mule.runtime.core.api.util.func.CheckedFunction.apply(CheckedFunction.java:25)
at org.mule.runtime.core.api.rx.Exceptions.lambda$checkedFunction$2(Exceptions.java:84)
at org.mule.runtime.core.internal.util.rx.Operators.lambda$nullSafeMap$0(Operators.java:47)
at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:165)
at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:425)
at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:420)
at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:127)
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)
at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:345)
at reactor.core.publisher.FluxSubscribeOnValue$ScheduledScalar.run(FluxSubscribeOnValue.java:178)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:50)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:27)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:111)
at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748), while writing Avro at payload.
It seems to work for me. Maybe there is a problem trying to access the schema. Because I don't have access to that URL I replaced it with a local file:
output application/avro schemaUrl="classpath://schema.json"
Apparently the answer is pretty simple. I just needed to add schema to the end of my URL. This removes the extraneous items like version and id that come down without it.
New Dataweave
%dw 2.2
output application/avro schemaUrl="http://schema-registry.domain.com:8081/subjects/Coupon-value/versions/1/schema"
---
payload

Getting error object field starting or ending with a [.]

While inserting the below document in an Elasticsearch index:
{
"id": "122223334444",
"name": "Mei",
"url": "mei-2019-tamil",
"alternate_urls": [
"mei-2019-tamil",
"sa-baskaran-aishwarya-rajesh-untitled"
],
"type": "Movie",
"poster": "ed3e439b-1ac1-45fe-a915-a5dae60257df",
"poster_url": "//assets.appserver.com/ed3e439b-1ac1-45fe-a915-a5dae60257df",
"alternate_names": [
"Mei",
"SA Baskaran - Aishwarya Rajesh Untitled"
],
"popularity": 0.2,
"info": {
"running_time": 0,
"cpl_types": [
"teaser",
"feature"
],
"has_cpls": true,
"genres": [
"Drama",
"Thriller"
],
"international_release_date": null,
"country_specific_release_dates": {},
"international_film_status": "CS",
"country_specific_film_statuses": {
"IN": "CS",
"CN": "CS",
"": "CS",
"SG": "CS"
},
"country_specific_certifications": {},
"language": "Tamil",
"synopsis": "A thriller film directed by SA Baskaran, starring Aishwarya Rajesh in the lead role.",
"schedules": {
"cities": [],
"countries": []
},
"featured": 0,
"movie_rating": 0,
"cast": [
{
"id": "05ffe715-db60-4947-a45a-99722537571c",
"name": "Aishwarya Rajesh",
"url": "aishwarya-rajesh",
"role": "Actress",
"poster": "65ab15b6-d54a-4965-95d5-38a839cee17d",
"poster_url": "//assets.appserver.com/65ab15b6-d54a-4965-95d5-38a839cee17d",
"type": "Person"
}
],
"crew": [
{
"id": "d9354648-5f48-4bf0-9a00-3de8c4d7a8d0",
"name": "SA Baskaran",
"url": "sa-baskaran",
"role": "Director",
"poster": null,
"poster_url": null,
"type": "Person"
}
]
},
"published": true
}
I'm getting the following Message:
Error: object field starting or ending with a [.] makes object
resolution ambiguous:
However, there is no value that is starting with .
I am clueless as regards which key is causing this issue.
Please help me identify and fix this issue.
ElasticSearch Version: 5.6.14
I am trying to index ES from a rails app using chewy gem.
Values of the JSON could be empty. But if the keys are empty then ES throws an error while indexing. Remove "":{} from the JSON and index again.
Reference: https://discuss.elastic.co/t/object-field-starting-or-ending-with-a-makes-object-resolution-ambiguous/123351

Office 365 API - Get meeting room location and capacity

I'm doing an integration of mobile app with the Office 365 Calendar. I want to show room capacity and location on the screen. I trying to find an API to get meeting room info (this info is available on website when selecting room as user).
I tried both Outlook REST API (version 2.0) and Microsoft Graph but found nothing in the docs on how to get such info.
Where I can find such API if it exists?
I know this is an old question but you can do it using the List Places API in Graph API: https://learn.microsoft.com/en-us/graph/api/place-list?view=graph-rest-1.0&tabs=http
GET https://graph.microsoft.com/v1.0/places/microsoft.graph.room
RESPONSE:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#places/microsoft.graph.room",
"value": [
{
"id": "3162F1E1-C4C0-604B-51D8-91DA78989EB1",
"emailAddress": "cf100#contoso.com",
"displayName": "Conf Room 100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"latitude": 47.640568390488626,
"longitude": -122.1293731033803
},
"phone": "000-000-0000",
"nickname": "Conf Room",
"label": "100",
"capacity": 50,
"building": "1",
"floorNumber": 1,
"isManaged": true,
"isWheelChairAccessible": false,
"bookingType": "standard",
"tags": [
"bean bags"
],
"audioDeviceName": null,
"videoDeviceName": null,
"displayDevice": "surface hub"
},
{
"id": "3162F1E1-C4C0-604B-51D8-91DA78970B97",
"emailAddress": "cf200#contoso.com",
"displayName": "Conf Room 200",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"latitude": 47.640568390488625,
"longitude": -122.1293731033802
},
"phone": "000-000-0000",
"nickname": "Conf Room",
"label": "200",
"capacity": 40,
"building": "2",
"floorNumber": 2,
"isManaged": true,
"isWheelChairAccessible": false,
"bookingType": "standard",
"tags": [
"benches",
"nice view"
],
"audioDeviceName": null,
"videoDeviceName": null,
"displayDevice": "surface hub"
}
]
}

Avro schema issue when record missing a field

I am using the NiFi (v1.2) processor ConvertJSONToAvro. I am not able to parse a record that only contains 1 of 2 elements in a "record" type. This element is also allowed to be missing entirely from the data. Is my Avro schema incorrect?
Schema snippet:
"name": "personname",
"type": [
"null":,
{
"type": "record",
"name": "firstandorlast",
"fields": [
{
"name": "first",
"type": [
"null",
"string"
]
},
{
"name": "last",
"type": [
"null",
"string"
]
}
]
}
]
If "personname" contains both "first" and "last" it works, but if it only contains one of the elements, it fails with the error: Cannot convert field personname: cannot resolve union:
{ "last":"Smith" }
not in
"type": [ "null":,
{
"type": "record",
"name": "firstandorlast",
"fields": [
{
"name": "first",
"type": [
"null",
"string"
]
},
{
"name": "last",
"type": [
"null",
"string"
]
}
]
}
]
You are missing the default value
https://avro.apache.org/docs/1.8.1/spec.html#schema_record
Your schema should looks like
"name": "personname",
"type": [
"null":,
{
"type": "record",
"name": "firstandorlast",
"fields": [
{
"name": "first",
"type": [
"null",
"string"
],
"default": "null"
},
{
"name": "last",
"type": [
"null",
"string"
],
"default": "null"
}
]
}
]

Resources