Open Closed

POST request in module giving 400 #1032


User avatar
0
Neozzz created

While trying to POST an entity "organization" to a module solution, it is not accepting saying that the name field is not available. Also I had implemented a separate controller in the HttpApi project for handling requests, but looks like it is not being used. Would like to know why the name field is not being shown on swagger  POST request section also should we init when doing a separate controller?

I have added the github link for the module solution we created. The idea is to put this module solution to a microservice solution once this module development is finished. Is this approach correct?

Thank you

  • ABP Framework version: v4.2.1
  • UI type: MVC
  • DB provider: EF Core
  • Exception message and stack trace:
  • Steps to reproduce the issue:

6 Answer(s)
  • User Avatar
    0
    alper created
    Support Team Director

    you cannot use the same organization entity in your module because modules must be independent and not tight coupled to main solution. therefore you need to create a new (duplicate) organization in your module eg: MyOrganization and map the original organization to MyOrganization. otherwise your module cannot be a real module. as a summary, you shouldn't need your main application while developing your module. otherwise it cannot be a reusable module.

  • User Avatar
    0
    alper created
    Support Team Director

    also I deleted your GitHub link because it's not allowed to share the commercial solution publicly

  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    While trying to POST an entity "organization" to a module solution, it is not accepting saying that the name field is not available. Also I had implemented a separate controller in the HttpApi project for handling requests, but looks like it is not being used. Would like to know why the name field is not being shown on swagger POST request section also should we init when doing a separate controller?

    Because it has private setter.

    We're alos improving the microservice solution that I highly recommend you to check microservice template docs if you haven't already.

    Also please make your repository private, commercial applications shouldn't be host in public repositories.

  • User Avatar
    0
    Neozzz created

    While trying to POST an entity "organization" to a module solution, it is not accepting saying that the name field is not available. Also I had implemented a separate controller in the HttpApi project for handling requests, but looks like it is not being used. Would like to know why the name field is not being shown on swagger POST request section also should we init when doing a separate controller?

    Because it has private setter.

    We're alos improving the microservice solution that I highly recommend you to check microservice template docs if you haven't already.

    Also please make your repository private, commercial applications shouldn't be host in public repositories.

    Hi Thank you for the reply. That worked. Thanks !

    I had created a controller inside the httpApi project as well. But it looks like the end point is still handled by the framework itself. How can we configure the framework to use the new controller?

    Thank you

  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Did you check this answer and the answers for this question? They seem similar for your case.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 19, 2024, 12:56