Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Andrew Brown
    @andrew-brown-lm
    We used to be able to include "id" values as int and have published our openapi spec as such. While testing with v5.0.0-pre1 this is now explicitly disabled. Would it be possible to remove that restriction?
    {
      "data": {
        "type": "contacts",
        "id": 4847986,
        "attributes": {
          "middleName": "Howard",
    5 replies
    NarayanaRaoNalla
    @NarayanaRaoNalla

    By default in the response for links, it’s adding the default location url route as prefix when we use options.UseRelativeLinks = false; . In our case we want to replace the prefix with our own domain value instead of the request domain. (Our scenario: we are our API’s behind the API gateway in a separate data center, so we wanted to get the route prefix as the apigateway url instead of where it’s hosted)

    Current response

    {
    "links": {
    "self": https://api.test.com/customers
    },
    "data": {
    "type": "customers",
    "id": "5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e",
    "attributes": {
    "firstName": "FN110211",
    "lastName": "LN110211",
    "companyName": "Cpny110211",
    "email": test110211@yopmail.com,
    "phoneNumber": "614-334-3290",
    "accountNumber": "00000707",
    "customerReferenceNumber": "Ref110211",
    "cultureCode": "en-US",
    "manageSecurity": true,
    "tenantId": "0685d838-7cc1-47f0-94af-b92564cff1aa",
    "billingAddress": {
    "addressLine1": "Francisco Expressway",
    "addressLine2": "96152 Swaniawski Curve",
    "city": "Smyrna",
    "state": "OH",
    "postalCode": "19348",
    "countryCode": "SE"
    }
    },
    "relationships": {
    "partner": {
    "links": {
    "self": https://api.test.com/customers/5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e/relationships/partner,
    "related": https://api.test.com/customers/5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e/partner
    }
    }
    },
    "links": {
    "self": https://api.test.com/customers/5c2485d3-1fb6-4f2f-be26-0b96f6aeef7e
    }
    }
    }

    Request url : https://api.dev.gateway.com/customers

    API hosted at : https://api.test.com/customers

    What we want response links should have https://api.dev.gateway.com instead of https://api.test.com

    1 reply
    LeszekKalibrate
    @LeszekKalibrate
    Hi
    Can anyone point me to documentation where it shows what is the limit for PATH? Or number of Ids?
    LeszekKalibrate
    @LeszekKalibrate
    Multiple filter values can be combined in a comma-separated list - in:1,2,3... up to 2000 characters?
    LeszekKalibrate
    @LeszekKalibrate
    ok, it is netcore limit. thanks
    Bart Koelman
    @bart-degreed
    @LeszekKalibrate Correct, there are no hard limits on path or filters within JADNC, so you'll have to look at ASP.NET, EF Core, and your database of choice for such limits.
    NarayanaRaoNalla
    @NarayanaRaoNalla

    Hi,

    We have Added JsonApiResourceService (ex: services.AddScoped<IResourceService<Customer, Guid>, CustomerService>();) in Startup.cs and kept all our validations and business logic in the class by inherting JsonApiResourceService<Customer, Guid>.

    But when we invoke the Unittest we are facing the "object reference not set to an instance of an object " error in this line: return base.GetAsync(cancellationToken);
    Please help how we can mock the JsonApiResourceService<Customer, Guid>?

    5 replies
    Björn Harrtell
    @bjornharrtell
    I'm put in a situation where I need to argue why JSON API instead of GraphQL. I only have limited experience of GraphQL and I find them overlapping quite a but I like JSON API more but find it hard to find good arguments. Any opinions on JSON API vs GraphQL?
    2 replies
    Jerome Haltom
    @wasabii
    Heya. So... been awhile... I'm trying to figure out the best way to approach an entity type where some properties come from a different data source. For instance, in my app, I have a Tag entity, stored in SQL (EF). However, it has an X, Y and Z property which I need to obtain from an Apache Ignite cache.
    1 reply
    Andrew Brown
    @andrew-brown-lm
    Just curious @bart-degreed if you have any guess as to when JADNC 5.0 (and specifically ef.core 6) will be production ready? Are there any big blockers you need help with?
    1 reply
    F. DeWayne Lane
    @fdlane

    We are using v4.2 for an Ember app. The app allows the user to create fairly complex filters, which JADNC handles wonderfully.

    However, now we need access to the LINQ statement that is generated from the user's defined filter and use the LINQ in a long-running background task. The background task creates a report that can be later downloaded.

    I would love some guidance around the layer of JADNC that we can "intercept" the LINQ statement that the user's filter produces.

    I am trying to avoid duplicating the work JADNC does to convert the query string into LINQ.

    8 replies
    databrecht
    @databrecht

    Hi all, when deleting entities in 5.0.0-pre, did someone else notice errors in the trend of:

    Failed to persist changes in the underlying data store.
          JsonApiDotNetCore.Repositories.DataStoreUpdateException: Failed to persist changes in the underlying data store.
           ---> Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

    ? It seems to happen with most of my resources but didn't notice it yet before. The query that is generated does seem to make sense:

    DELETE FROM datapoints
          WHERE id = @p0 AND project_id = @p1;
    5 replies
    (keys are defined as id + project_id, maybe that's not something we JSON API dotnet is happy with atm)
    dickalexei
    @dickalexei

    Hi, I have a DB with tables:

    -Objects
    -Groups
    -GroupsObjects
    -Users
    -UsersObjects
    -UsersGroups
    -UsersObjects

    So an Object can be linked to one User directly or indirectly via a Group, or even both.

    When I browse the Users route with included Objects, i have only the objects linked directly to the Users. But I want to know if there is an easy way to include all the Objects (those linked directly to the User and those linked to the User via Group table). All this without link them in DB.

    The only way i see is by overriding the OnSerialize function in UserDefinition and add Objects from Groups in the User manually.

    Hope it's clear :)

    2 replies
    Benjamin Evenson
    @benjiro

    Hi @bart-degreed, I've just spent some time upgrading to JADNC 5.0.0-pre and EFCore6 and noticed that nested paging still seems to be broken. I've observed that EFCore6 is producing a query that has TOP (PageSize) and on the nested relationship it also using Row_Number, the end result is a query that takes 2+mins(timeout) to run but when I turn back on the workaround all is good. Have you observed any weirdness in this area? I'll try and create a repo of the issue.

    RE json-api-dotnet/JsonApiDotNetCore#922

    Bart Koelman
    @bkoelman
    I'm not aware of such a limitation. But a timeout sounds like a different problem. Did you review the SQL execution plan for full table scans? Please create an issue with repro steps if you need help.
    Benjamin Evenson
    @benjiro
    Yea its doing a full table scan. Sure give me a couple of days bit tight for time at the moment. The same problem existed in 4.2.0/EFCore5 only work around was to disable nested pagination.
    Bart Koelman
    @bkoelman
    Can't you just add an index?
    Benjamin Evenson
    @benjiro
    Yea you're correct, I assumed the index already existed. Thanks for the suggestion :thumbsup:
    Bart Koelman
    @bart-degreed
    @/all At work, I gave a presentation on JSON:API and JsonApiDotNetCore, with a small demo at the end. You can watch it in HD at https://www.youtube.com/watch?v=79Oq0HOxyeI.
    Also: From now on I'll be using my bkoelman GitHub account instead of bart-degreed.
    Bart Koelman
    @bkoelman
    Announcement: The final v5 releases of JsonApiDotNetCore and JsonApiDotNetCore.MongoDB are available for download! See the release notes here.
    Jerome Haltom
    @wasabii
    Hey. Is there any guidance for implementing a JSON API profile? One of the things I'd like to add is permissions/roles to each object. At a minimum, what operations the requester is allowed to do based on his permissions.
    11 replies
    Björn Harrtell
    @bjornharrtell
    Taking 5.0.1 for a spin and getting only 404 responses.. is controller generation just supposed to work in non visual studio envs?
    Björn Harrtell
    @bjornharrtell
    Hmm cloned latest source and dotnet run on https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples/GettingStarted and getting 404 on localhost:14141/api/people
    Bart Koelman
    @bart-degreed
    I can't reproduce, but I recall Maurits had issues some time ago which were caused by an old version of the .net 6 runtime on his machine. Are you using the latest?
    Björn Harrtell
    @bjornharrtell
    I was (unknowingly) stuck at 6.0.102, fixed and now 6.0.202 and it works as expected.
    Bart Koelman
    @bkoelman
    Great, thanks for the update.
    Björn Harrtell
    @bjornharrtell
    I've got a little project where I aim to use sqlite also in production because it is a read only database.. but when attempting to a include with nested relationship I'm bitten by "Translating this query requires the SQL APPLY operation, which is not supported on SQLite". Can that be worked around or does that mean that sqlite simply will not do?
    Björn Harrtell
    @bjornharrtell
    Switched to inmemory db and it can do it.. it says do not use in production but I just might.. :P
    Bart Koelman
    @bkoelman
    Björn Harrtell
    @bjornharrtell
    Mm yes it would fit quite well.. And I'm not sure I agree with that EF Core requires that a provider implements lateral join to support these kind of queries, it should be possible to use another strategy.
    Björn Harrtell
    @bjornharrtell
    What is the status of json-api-dotnet/JsonApiDotNetCore#1046 ? is in a usable state? I have a customization that more or less creates useful openapi as "simple" customization on the AddSwaggerGen configuration but would like to move away from it. Perhaps I can contribute?
    Shrihari Hallur
    @shrihari1857
    I need to call a downstream JSON:API api, how do I use JSONApiDotNetCore to construct the query string to include filters, sorting and pagination info? Do I need to do something with QueryLayer or QueryLayerComposer? Is there an example somewhere?
    1 reply
    Björn Harrtell
    @bjornharrtell
    @bkoelman : This is generated dynamically from a JADNC 4 project using a little custom mapping code - https://arealeditering-api.udv.miljoeportal.dk/swagger
    1 reply
    Björn Harrtell
    @bjornharrtell
    Why are filters with bracket notation for relationships restricted to to-many? Wouldn't it make sense to also support to-one?
    4 replies
    Björn Harrtell
    @bjornharrtell
    Is there a way to make it possible to filter on unmapped properties? I currently get "Translation of member 'xxx' on entity type 'yyy' failed. This commonly occurs when the specified member is unmapped"
    The reason I got into that mess is that I've used the method described in https://stackoverflow.com/questions/50375357/how-to-create-a-table-corresponding-to-enum-in-ef-core-code-first as I found it a nifty way to model enums as relations behind the scenes.
    Rephrased, is there a way to force JADNC to materialize before doing linq queries?
    3 replies
    Björn Harrtell
    @bjornharrtell
    Why is type identifier in plural? (unless I'm mistaken)
    Björn Harrtell
    @bjornharrtell
    I see now that the spec says "This spec is agnostic about inflection rules, so the value of type can be either plural or singular. However, the same value should be used consistently throughout an implementation." so nevermind. :)
    sarahentzel
    @sarahentzel
    I'm trying to write an export in the api that serializes many objects into a zip file and sends the zip file. In the original version I just injected IJsonApiSerializer and serialized my dbContext.organizations (etc) with string thisdata = jsonApiSerializer.Serialize(entity); IJsonApiSerializer is no longer available and I can't figure out what to inject now to get the same serialization I would get if it was sent as a response body.
    18 replies
    Wayne Douglas
    @wayne-o
    Hi, I've written a javascript query builder for JsonApiDotNetCore: https://www.npmjs.com/package/json-api-query - it's my first real attempt at typescript / public NPM packages and a few other things so i hope it's good enough in terms of standards - I know it needs some work :) I've written it in lunch breaks and weekends so it's not had the focus I would have liked to give it. If anyone does get around to trying it out and finds any issues / has improvements they can suggest please file an issue on GH :)
    1 reply
    sarahentzel
    @sarahentzel
    I'm trying to upgrade to the latest version of JsonAPIDotNetCore but...In my invitation UpdateAsync when an invitation is Accepted, I'm then trying to create an organizationMembership. I injected an OrganizationMembershipService and I'm calling CreateAsync on that service (from within InvitationService) but it gets an error because the targetedField has Accepted (from the original Invitation call). How should this be structured instead?
    5 replies
    Bart Koelman
    @bkoelman
    @/all Please ask your non-trivial questions (ie. how to solve a problem) through our issue tracker. I've added a template for questions. By filling out the details we need, we can provide better answers faster.
    Björn Harrtell
    @bjornharrtell
    Is there a practical way to separate model class definition with resource class definition?
    Björn Harrtell
    @bjornharrtell
    Unless I'm missing something I think it would require json-api-dotnet/JsonApiDotNetCore#776, is that correct?
    1 reply
    Gerry Hull W1VE/VE1RM/VY1AAA etc...
    @w1ve_twitter
    I've seen some messages about support for Swagger, but nothing in recent times. Is there a way to make Swagger work with JsonApiDotNet? We are using the latest release. A sample would be great if it's possible.
    1 reply
    Ryan Joseph Rivard
    @ryan.rivard1_gitlab
    Hi all, I was wondering if anybody else had run into issues with JANC seemingly just not initializing on certain machines. Locally my project works great, but once I deploy to our dev servers, no endpoints are generated. I do not see any errors in our logs, either. Locally I'm running .NetCore 6.0.7 runtime, same as the server. Locally I have 6.0.302 SDK installed, while the server only has 3.1.x SDK installed. Reading up a few messages it sounds like maybe JANC has some issues with certain versions of .Net? Is there another solution to this perhaps, as I do not have the admin privileges necessary to install new runtimes/sdks on our dev/test/etc environments.
    1 reply
    Gerry Hull W1VE/VE1RM/VY1AAA etc...
    @w1ve_twitter

    We are developing a rich REST Api usingJsonApiDotNetCore library (5.0.1). We have many dozens of APIs working just fine.

    However, today I updated my VS 2022 to 17.3.0, and now when I try to run I get the error JsonApiDotNetCore.Errors.InvalidConfigurationException with the message "Multiple controllers found for resource type ..."

    Running the same source on a non-updated VS2022 works just fine.

    Any clues out there?

    2 replies