-
Notifications
You must be signed in to change notification settings - Fork 3
Output formats #494
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
Output formats #494
Conversation
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 think (since this is like a demo format), all properties should be duly documented (for OAS).
| public int $code; | ||
|
|
||
| #[FPost(new VMixed())] | ||
| public mixed $payload; |
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 properties should be properly documented (described) for OAS.
|
I added descriptions to the formats (please check, some are really surface level because I could not infer much from the code). I also added a new feature, where Format classes can be used for validation even in loose attributes: #[Query(
"filters",
new VObject(UserFilterFormat::class),
"Named filters that prune the result.",
required: false,
nullable: true,
)]
public function actionDefault(Although annotating key-value stores in URL parameters with |
| public array $students; | ||
|
|
||
| #[FPost(new VUuid(), required: false)] | ||
| #[FPost(new VUuid(), "The instance ID of the group", required: false)] |
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.
ID of an instance in which the group belongs.
| public string $instanceId; | ||
|
|
||
| #[FPost(new VBool())] | ||
| #[FPost(new VBool(), "Whether the group has a valid license")] |
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.
Whether the instance where the group belongs has a valid license.
| public array $shadowAssignments; | ||
|
|
||
| #[FPost(new VBool())] | ||
| #[FPost(new VBool(), "Whether the group statistics are public")] |
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.
Whether the student's results are visible to other students.
| public bool $publicStats; | ||
|
|
||
| #[FPost(new VBool())] | ||
| #[FPost(new VBool(), "Whether the group is detaining")] |
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.
Whether the group detains the students (so they can be released only by the teacher).
| public bool $detaining; | ||
|
|
||
| #[FPost(new VDouble(), required: false)] | ||
| #[FPost(new VDouble(), "The group assignment point threshold", required: false)] |
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.
A relative number of points a student must receive from assignments to fulfill the requirements of the group.
| public ?float $threshold; | ||
|
|
||
| #[FPost(new VInt(), required: false)] | ||
| #[FPost(new VInt(), "The group points limit", required: false)] |
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.
A minimal number of points that a student must receive to fulfill the group's requirements.
| public array $bindings; | ||
|
|
||
| #[FPost(new VTimestamp(), required: false)] | ||
| #[FPost(new VTimestamp(), "The time when the exam starts if there is an exam", required: false)] |
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.
....exam scheduled.
| public ?int $examBegin; | ||
|
|
||
| #[FPost(new VTimestamp(), required: false)] | ||
| #[FPost(new VTimestamp(), "The time when the exam ends if there is an exam", required: false)] |
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.
...scheduled.
| public ?int $examEnd; | ||
|
|
||
| #[FPost(new VBool(), required: false)] | ||
| #[FPost(new VBool(), "Whether there is a strict exam lock", required: false)] |
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.
Whether the scheduled exam requires a strict access lock.
| public ?bool $examLockStrict; | ||
|
|
||
| #[FPost(new VArray())] | ||
| #[FPost(new VArray(), "All group exams")] |
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.
All past exams (with at least one student locked).
This PR adds response Formats.
Action methods can be annotated with the
ResponseFormatattribute that link them to a Format class similarly to how theFormatattribute works.Response Formats are only used for swagger generation to detail each response of the endpoint.
The
GroupFormatclass was added with a nestedGroupPrivateDataFormatthat was used on manyGroupsPresenterendpoints.Additionally, the PR adds a performance improvement to the
BasePresenterthat memoizes loose attributes.