tried to redefine existing error around graphql - graphql

I have 2 project(graphql client) with schema.graphqls each fro different graphql endpoints, and have some same definitions.
Project A
--schema.graphqls
--type Order...
type Product...
Project B
--schema.graphqls
--type order...
type Product...
The project A and B managed by a parent project like below
<modules>
<module>../projectA</module>
<module>../proejctB</module>
So, when I run one of the 2 project will throw the error below
There are problems with the GraphQL Schema:
* 'Mutation' type [#307:1] tried to redefine existing 'Mutation' type [#10:1]
* 'Order' type [#374:1] tried to redefine existing 'Order' type [#455:1]
* 'OrderConnection' type [#421:1] tried to redefine existing 'OrderConnection' type [#439:1]
* 'OrderEdge' type [#429:1] tried to redefine existing 'OrderEdge' type [#447:1]
* 'PaymentMethod' type [#502:1] tried to redefine existing 'PaymentMethod' type [#501:1]
* 'Product' type [#518:1] tried to redefine existing 'Product' type [#571:1]
How can I resolve the issue? Thanks a lot!

Related

Use url.URL with controller-gen

I'm trying to develop a custom resource on kubernetes with kubebuilder.
In this CR, I have a field of type url.URL
I get this error :
(*in).DeepCopyInto undefined (type *url.URL has no field or method DeepCopyInto)
Is there a way to work with type url.URL when developing a CR ?
Thanks
So I found a solution
I don't know if it's the best but I've created a custom type URL with the part which is missing to use net/url with controller-gen.
It works fine
https://gist.github.com/quentinalbertone/ec00085b57992d836c08d4586295ace7

Undeclared property when creating a record via Web API In Dynamics CRM Online

I am trying to create an entity in Dynamics CRM online with a custom lookup field. Even after providing the SchemaName(sg_DepartmentalProjectId) as mentioned here 'An undeclared property' when trying to create record via Web API I am still getting the same error.
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'sg_DepartmentalProjectId' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.
Below is my JSON Post
{
"sg_invoicenumber": "SIAIR402742-416805",
"sg_accountnumber": "5400",
"sg_description": "xxxx",
"sg_fy": "20",
"sg_name": "Operational Journal: yyy - 09/20/2019",
"sg_departmentid": "CC10530",
"sg_postingdate": "2019-09-20",
"sg_invoicedate": "2019-09-20",
"sg_checkdate": "2019-09-20",
"sg_paidfulldate": "2019-09-24",
"sg_amount": 5597.4,
"sg_effectivedate": "2019-09-20",
"sg_DepartmentalProjectId#odata.bind":"/sg_departmentalmatters(e9c31cec-deff-e411-80c5-0050569732ae)"
}
Please Download Odata Metadata from the Developer resources & verify the exact casing. Jason Lattimer also confirmed that the bug while investigating the CRM REST builder issue:
I've come to figure out the metadata is in fact not the source of truth - it's the CSDL
I know it's super annoying when this is working different & getting solved by different solutions. Make sure you verify in all these places for the custom lookup attribute.
Microsoft reference: CSDL $metadata document
I had the same problem, but in my case using the schema name didn’t work. I believe it’s because my field is setup as a navigation property to either of two different entities. I found the correct name by pulling the metadata for the entity from the API and looking at the navigation properties. There were two navigation properties defined for this field, one for each target entity, so I had to use the name of the correct one in my payload.
<NavigationProperty
Name="parentcustomerid_account"
Type="mscrm.account"
Nullable="false"
Partner="contact_customer_accounts">
<ReferentialConstraint
Property="_parentcustomerid_value"
ReferencedProperty="accountid" />
</NavigationProperty>
The correct value was parentcustomerid_account above.
I had same issue
JSON:
{
"activityid": "cbf73794-9e42-ec11-8c62-00224815945f",
"subject": "Test 22",
"new_AppointmentTypeId#odata.bind": "new_tasktypes(a97ec3cf-3e1a-ea11-a811-000d3a799417)"
}
Error I was getting:
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'new_AppointmentTypeId' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.
Resolution:
Use Metadata Browser https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/browse-your-metadata?view=op-9-1
Find ReferencingEntityNavigationProperty from Metadata Browser for fields you need it.
Working JSON:
{
"activityid": "cbf73794-9e42-ec11-8c62-00224815945f",
"subject": "Test 22",
"new_AppointmentTypeId_Appointment#odata.bind": "new_tasktypes(a97ec3cf-3e1a-ea11-a811-000d3a799417)"
}

Is there a way to create an object of a specific type, based on a value of a string variable (not the string type)?

I'm trying to instance multiple objects of diverse types based on what you set on the config file.
Also, I'm trying to avoid to use the 'switch' statement with every Type of object that you can instance.
My original idea was use sort type of reflection, to create a object with a Type obtained from a config value.
For example:
These is a YAML Config example
workers:
- type: "Type1"
parameters:
param_0: "test"
param_1: 1000
- type: "Type2"
parameters:
param_0: "test"
param_1: 1000
When these settings are analyzed; at run-time, the program must instance a "Type1" object with the "Parameters"; and then another instance of a "Type2" object with its "Parameters".
Please let me know if you need more information about it.
PD: Sorry for my bad English.

NEST trying to convert enum to string

Good day:
I have the following code however, I'm getting the following error:
return new ConnectionSettings(pool, (s, v) => s.Converters.Add(new StringEnumConverter())).DefaultIndex(index)
.DefaultMappingFor<Document>(m => m.IndexName(index).TypeName("doc"))
.DefaultMappingFor<FacilityType>(m => m.IndexName(index).TypeName("doc"))
.DefaultMappingFor<Facility>(m => m.IndexName(index).TypeName("doc").RelationName("parent"))
.BasicAuthentication(ConfigurationManager.AppSettings["ElasticUser"], ConfigurationManager.AppSettings["ElasticPassword"]);
Severity Code Description Project File Line Suppression State
Error CS1061 'IElasticsearchSerializer' does not contain a definition for 'Converters' and no extension method 'Converters' accepting a first argument of type 'IElasticsearchSerializer' could be found (are you missing a using directive or an assembly reference?) iserro.API C:\Users\IEUser\source\repos\iserro-api\iserro.API\App_Start\DiContainerConfig.cs 131 Active
I think the error message clearly indicates what the problem is.
It looks like you'd like IElasticsearchSerializer to be a concrete instance that exposes a Converters property, which the JsonNetSerializer type in the Nest.JsonNetSerializer NuGet package exposes so you can hook it up and add custom converters.

Creating an instance of a structure with unexported sub-structures in Go

I am trying to manually create an instance of the type ReactionAddedEvent given here, in nlopes' Go Slack library. However, the sub-type reactionItem is unexported, which leads me to receive the error ./bot_test.go:111: cannot refer to unexported name slack.reactionItem when trying to instantiate the object.
Here is my code:
m := &slack.ReactionAddedEvent{
Item: &slack.reactionItem{
File: &slack.File{
Preview: "Test",
URLPrivate: "http://google.com",
},
},
Reaction: "white_check_mark",
}
When I remove the identifier &slack.reactionItem from line 2 in that snippet, I get instead the error: ./bot_test.go:112: missing type in composite literal, obviously.
Is there any way for me to instantiate an object of this type with the parameters I need?
First, if slack here refers to the nlopes library, the slack.ReactionAddedEvent structure's Item field is not a pointer, so you can't store an address of a slack.reactionItem struct into that field anyway. Second, the File field of slack.reactionItem is a string, not a structure.
Third, even if the above isn't/weren't the case, if the types are not exported, but the fields themselves are, you can't assemble the structure in a single literal. Instead, you'll have to manually set those fields after creating the structure variable:
m := &slack.ReactionAddedEvent{Reaction: "white_check_mark"}
m.Item.File.Preview = "Test"
m.Item.File.URLPrivate = "http://google.com"
But again, if you're using the nlopes library, that won't work because the File field isn't actually a structure:
https://github.com/nlopes/slack/blob/master/websocket_reactions.go
And fourth, if the type isn't exported, that's probably a good sign that you shouldn't be manipulating objects of that type. In this case, in the nlopes library, those structures are only intended to be used for unmarshalling and then handling events from JSON messages.

Resources