Skip to content

Add create cqrs endpoint doc #2013

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

Merged
merged 2 commits into from
Aug 6, 2025
Merged

Conversation

tleon
Copy link
Contributor

@tleon tleon commented Jul 25, 2025

Questions Answers
Branch? 9.x
Description? Add documentation for creating a new endpoint using CQRS
Fixed ticket? Fixes #39179

@tleon tleon self-assigned this Jul 25, 2025
@github-actions github-actions bot added the 9.x label Jul 25, 2025
@kpodemski kpodemski self-assigned this Jul 28, 2025
Copy link
Contributor

@kpodemski kpodemski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to deep-dive into the review, but, in my eyes, this piece of content you created is a mix of an article for BuildBlog and actual documentation. It's good! But it could use some improvements and changes to better fit into the docs.

I'm sharing with you my observations and thoughts. I know this article will also be reviewed by @cnavarro-prestashop and @jolelievre, so I'll let them decide on how to proceed.

  1. We should help devs understand how CQRS works in PrestaShop, and we do have a documentation for that (https://devdocs.prestashop-project.org/9/development/architecture/domain/cqrs/), unfortunately, I'm not sure to what extent it is up-to-date :(
  2. I think that in certain areas of this guide, we lack a clear explanation of why we should do things the way we do. ApiResourceMapping, gridDataFactory, and filtersMapping will all raise questions.
  3. The metadata used (CQRSCreate, etc.) comes out of nowhere unless someone reverse-engineers their meaning. We don't need to be super detailed about those, maybe link to the source on GitHub. Again, we have some docs ready to explain better how the API works under the hood, so perhaps it's better to link to the existing resources (https://devdocs.prestashop-project.org/9/admin-api/resource_server/api-platform/).
  4. Should we, and when, add unit tests apart from integration ones? And an extra question: will they be required from community contributors?
  5. Naming convention could be linked to https://github.com/PrestaShop/ADR/blob/master/0023-cqrs-api-guidelines.md
  6. There's a mix in the naming. In the tests, you have /attributes/group

@@ -0,0 +1,908 @@
---
title: Create a new endpoint using CQRS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Create a new endpoint using CQRS
title: Creating a new resources using CQRS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we ask contributors to add endpoints, I think this guide is more about adding new resources, right?

So, I think it should be something like:

Creating a new Admin API resource using CQRS

Maybe this statement below could help people understand the concept a bit better?

In the context of PrestaShop's Admin API, each resource corresponds to one or more HTTP endpoints that support CRUD operations.

@@ -0,0 +1,908 @@
---
title: Create a new endpoint using CQRS
menuTitle: New CQRS endpoint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
menuTitle: New CQRS endpoint
menuTitle: Creating CQRS endpoints


# Create a new API endpoint using CQRS

This guide explains how to create a pull request for a new endpoint. This documentation is based on the [pull request](https://github.com/PrestaShop/ps_apiresources/pull/55) for the attribute group endpoints in PrestaShop's `ps_apiresources` module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a little more context on why the endpoints are part of the ps_apiresources module, what are the benefits, and mention that adding a new endpoint mean contributing/sending a pull request to this module.

The documentation should not focus on creating a pull request, it should focus on how the new endpoints are created. This will better fit documentation than a "how to contribute" piece of content that's better for build.prestashop-project.org.

@@ -0,0 +1,1023 @@
---
title: Create a new endpoint using CQRS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Create a new endpoint using CQRS
title: Contribute to Core API endpoints using CQRS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original title is better for a developer documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just discuss about it in meeting with @jolelievre. It's confusing bcz with "Create a new endpoint using CQRS", people will believe they can create a new endpoint on their shop, not contribute to Core endpoints.

But I let @jolelievre & you decide.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, ok, makes sense.

We definitely need both, a way for users to know how to add a new endpoint for themselves and to the core.

I'd say that for now we can change it, but later it would be wise to split this doc or add another chapter on how to make custom module as a provider for resources - @jolelievre would that work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep why not, we have a small section and example modules for that:

If there is a need for additional doc I'm always okay with it. But I won't be the one writing it next time 😅

@jolelievre jolelievre force-pushed the add-endpoint-doc branch 7 times, most recently from b3e7b9a to 9733946 Compare August 6, 2025 11:38
@jolelievre jolelievre merged commit 78f0903 into PrestaShop:9.x Aug 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants