-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/http api new approach #348
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
base: main
Are you sure you want to change the base?
Conversation
9a3a6aa to
aa2b625
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review covers only the early parts of routing and dispatching.
|
Oh, and I got the postgres tests working in my environment. Please get back to me for this. |
1705125 to
fe816f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked at channels and contact tests so far, next I will look at contactgroup tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add following changes as well:
- The PHPDoc for the method must contain a newline between different annotations, i.e.
@param,@return. - Update method PHPDoc if required.
- Make the
getPlural()method protected. - Remove the resolved todos.
30b0b1b to
da665ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss how we handle the openapi description and the usage of Swagger, as there are three possible solutions for me:
- Caching (properly, not the way it's right now ;) )
- CI (as your todo suggests)
- Static (it's a versioned api after all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing license header. It seems, not only this file is missing it, please make sure all PHP files have one.
ad9e5e8 to
00d3880
Compare
3863707 to
06a2750
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry, I didn't take a look at the validation/middleware stuff again 😜
library/Notifications/Api/OpenApiDescriptionElement/Response/SuccessDataResponse.php
Outdated
Show resolved
Hide resolved
|
Adjusted and extended the tests quite a bit. The failing tests uncover the following problems:
|
| foreach ($middlewares as $middleware) { | ||
| try { | ||
| $this->pipe($middleware); | ||
| } catch (\Exception $e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you really must throw your own exception, catch TypeError instead
| @@ -0,0 +1,31 @@ | |||
| # REST API | |||
|
|
|||
| The Icinga Notifications module provides a REST API that allows you to manage notification-related resources programmatically. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Icinga Notifications module Icinga Notifications Web
|
|
||
| This API enables easy integration with external tools, automation workflows, and configuration management systems. | ||
|
|
||
| --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| ## API Versioning | ||
|
|
||
| The Notifications API follows a **versioned** structure to ensure backward compatibility and predictable upgrades. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before
this API
This API
And now
Notifications API
Later
… API … reference
Please stick to a single version, so remove Notifications here.
| use Icinga\Module\Notifications\Model\Contactgroup; | ||
| use Icinga\Module\Notifications\Model\Rotation; | ||
| use Icinga\Module\Notifications\Model\RotationMember; | ||
| use Icinga\Module\Notifications\Model\RuleEscalationRecipient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed. These must not be used! The ORM must be bypassed.
| use Icinga\Exception\Json\JsonEncodeException; | ||
| use Icinga\Module\Notifications\Api\EndpointInterface; | ||
| use Icinga\Module\Notifications\Api\Exception\InvalidFilterParameterException; | ||
| use Icinga\Module\Notifications\Model\Contact; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, plus the ones below, no ORM usage
| $request | ||
| ->withAttribute('version', ucfirst($version)) | ||
| ->withAttribute('endpoint', ucfirst($endpoint)) | ||
| ->withAttribute('identifier', $identifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MySQL uses a normal char(36), whereas PostgreSQL uses a native type, but only the native type is case-insensitive, so we should lowercase here. I think it's fine to do it here and assume everywhere else that it's already lowercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh and, not sure what the validation middleware accepts, but we have to also make sure the UUID is exactly 36 chars. (No curly braces)

Initial setup for the new approach of the http-api with openapi description.
Resolves:
require:
external_uuidtocontact/contactgrouptable icinga-notifications#216