Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging Difficulties and Documentation Improvements #25

Closed
hughesjs opened this issue May 26, 2022 · 2 comments
Closed

Debugging Difficulties and Documentation Improvements #25

hughesjs opened this issue May 26, 2022 · 2 comments

Comments

@hughesjs
Copy link
Collaborator

I'm attempting to use this library but there seems to be a lack of information in the docs that's making this difficult.

For instance, it's not clear to me whether .BackingField() is required or not. It's also not clear when we have to use the various relationship building methods.

The best guess I can make from the quick-start is that .With() is used for each type your API can return and then you use BelongsTo() or HasMany() for any relationships that get returned for that object. However, that then raises the question of what we do when there's a single has relationship (there's no .Has()) or when an object might belong to many other objects.

This has currently led to me having developed quite a complicated model for the ESA's discosWeb API but I'm unable to get it to work. I get this error:

System.ArgumentException: "EqualityContract" property not found on type "DISCOSweb_Sdk.Models.ResponseModels.DiscosObjects.DiscosObject".

System.ArgumentException
"EqualityContract" property not found on type "DISCOSweb_Sdk.Models.ResponseModels.DiscosObjects.DiscosObject".
Check your contract resolver configuration. (Parameter 'field')
   at Hypermedia.Metadata.Runtime.RuntimeFieldAccessor.From[T](String field)
   at Hypermedia.Configuration.FieldBuilder`1..ctor(IContractBuilder`1 builder, RuntimeField field)
   at Hypermedia.Configuration.ContractBuilder`1.Field(String name)
   at Hypermedia.Configuration.ReflectionTypeDiscovery.Discover[TEntity](ContractBuilder`1 builder, TypeInfo type)
   at Hypermedia.Configuration.ReflectionTypeDiscovery.Discover[TEntity](IBuilder parent)
   at Hypermedia.Configuration.Builder.With[TEntity](ITypeDiscovery discovery)
   at Hypermedia.Configuration.BuilderExtensions.With[TEntity](IBuilder builder, String name)
   at DISCOSweb_Sdk.Mapping.JsonApi.DiscosObjects.DiscosObjectContractBuilder.WithDiscosObject(IBuilder builder) in /home/james/repos/DISOSweb-sdk/src/DISCOSweb-Sdk/DISCOSweb-Sdk/Mapping/JsonApi/DiscosObjects/DiscosObjectContractBuilder.cs:line 21
   at DISCOSweb_Sdk.Mapping.JsonApi.DiscosObjectResolver.CreateResolver() in /home/james/repos/DISOSweb-sdk/src/DISCOSweb-Sdk/DISCOSweb-Sdk/Mapping/JsonApi/DiscosObjectResolver.cs:line 22
   at DISCOSweb_Sdk.Tests.Client.ClientTests.CanFetchADiscosObject() in /home/james/repos/DISOSweb-sdk/src/DISCOSweb-Sdk/DISCOSweb-Sdk.Tests/Client/ClientTests.cs:line 20
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext() in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\Runners\TestInvoker.cs:line 264
--- End of stack trace from previous location ---
   at Xunit.Sdk.ExecutionTimer.AggregateAsync(Func`1 asyncAction) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\ExecutionTimer.cs:line 48
   at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in C:\Dev\xunit\xunit\src\xunit.core\Sdk\ExceptionAggregator.cs:line 90

But because of the lack of docs, I'm not even sure where to start. If you'd take a look at this PR and point me in the right direction, I'd really appreciate it.

If someone would be so kind as to explain this to me in a bit of detail, I'm more than happy to prepare additional docs and to contribute them with a PR.

@hughesjs hughesjs changed the title Documentation is Lacking Documentation is Lacking IMHO - Debugging Difficulties May 26, 2022
@hughesjs hughesjs changed the title Documentation is Lacking IMHO - Debugging Difficulties Debugging Difficulties and Documentation Improvements May 27, 2022
@hughesjs
Copy link
Collaborator Author

hughesjs commented May 27, 2022

Thanks @cosullivan for answering my SO question related to many-many relationships which helps somewhat with this but I would still appreciate some further guidance please. Then I'll be more than happy to contribute to the docs.

@hughesjs
Copy link
Collaborator Author

So I think my issue isn't actually to do with what I thought it was, so I'm closing this and opening a new issue for the actual issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant