Skip to content

chore: Improvements at response from API when generate root certificate#5198

Merged
vitormattos merged 15 commits intomainfrom
chore/correct-validate-field
Sep 1, 2025
Merged

chore: Improvements at response from API when generate root certificate#5198
vitormattos merged 15 commits intomainfrom
chore/correct-validate-field

Conversation

@Any97Cris
Copy link
Contributor

Pull Request Description

Related Issue

Issue Number: #1967

Pull Request Type

Chore

@Any97Cris Any97Cris self-assigned this Jul 4, 2025
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Jul 4, 2025
@vitormattos vitormattos changed the title chore: scenery validate test chore: scenary validate test Jul 7, 2025
@vitormattos vitormattos moved this from 0. Needs triage to 2. in progress in Roadmap Jul 9, 2025
@vitormattos vitormattos self-requested a review July 9, 2025 01:03
vitormattos

This comment was marked as resolved.

@github-project-automation github-project-automation bot moved this from 2. in progress to 1. to do in Roadmap Jul 9, 2025
@vitormattos vitormattos moved this from 1. to do to 2. in progress in Roadmap Jul 9, 2025
@vitormattos vitormattos force-pushed the chore/correct-validate-field branch from 195b468 to abfb7e6 Compare July 22, 2025 20:17
vitormattos

This comment was marked as resolved.

Copy link
Member

@vitormattos vitormattos left a comment

Choose a reason for hiding this comment

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

Now you need to recreate src/helpers/certification.js to send it to the front end. I think the best way is via an initial state, perhaps named certification_rules.

It might be a good idea to create a toArray method in the RulesServices class. This could be a good way to transform the PHP code into JavaScript Object Notation and send it serialized to the front end via the initial state.

And then, remove the src/helpers/certification.js matching the suggestion that was exposed at the issue:

To do this you will need to move the file apps-extra/libresign/src/helpers/certification.js to be a helper in API side and return this as JSON in an initial state to frontend.

@Any97Cris Any97Cris force-pushed the chore/correct-validate-field branch 2 times, most recently from 77b64e6 to 82548ab Compare August 21, 2025 20:11
@Any97Cris Any97Cris force-pushed the chore/correct-validate-field branch 3 times, most recently from cb4a7ad to 148d991 Compare August 28, 2025 20:23
Copy link
Member

@AntDavidLima AntDavidLima left a comment

Choose a reason for hiding this comment

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

Everything looks right to me. Great job!
I've just requested some changes related to some minor, not that important things.

throw new LibresignException('Parameter id is required!', 400);
}
$names[$item['id']]['value'] = $this->trimAndThrowIfEmpty($item['id'], $item['value']);
$names[$item['id']]['value'] = trim((string)$item['value']);
Copy link
Member

Choose a reason for hiding this comment

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

It may be good to rewrite this line in multiple lines, to make it easier to read. Something like:

$itemId = $item['id'];
$itemValue = strval($item['value']);

$names[$itemId]['value'] = trim($itemValue);

It's something silly, but may help people new to the application to understand it's code.

Copy link
Member

Choose a reason for hiding this comment

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

Isn't this too much vars?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe would be best create a fallback issue to implement a NormalizeService class to add the trim rule into all values and also add an uppercase rule into Country and maintain the scope of this PR more amalgamated with the issue that motivated this PR.

if ($length > $rule['max'] || $length < $rule['min']) {
throw new InvalidArgumentException(
$this->l10n->t(
"Parameter '%s' should be between %s and %s.",
Copy link
Member

Choose a reason for hiding this comment

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

Parameter '%s' should be between %s and %s characters. will be clearer, I think.

Copy link
Member

@vitormattos vitormattos Sep 1, 2025

Choose a reason for hiding this comment

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

characters only make sense when is about a string. The interval is numeric.

@github-project-automation github-project-automation bot moved this from 2. in progress to 1. to do in Roadmap Aug 29, 2025
Any97Cris and others added 7 commits September 1, 2025 09:35
Signed-off-by: Crisciany Souza <crisciany.souza@librecode.coop>
Signed-off-by: Crisciany Souza <crisciany.souza@librecode.coop>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
I changed because the previous scenaio name was a copy paste of first
scenario.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The entire name of this field is Common Name and not only Name.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos force-pushed the chore/correct-validate-field branch from 5740a33 to 4b43967 Compare September 1, 2025 12:40
@vitormattos
Copy link
Member

I only made a rebase without any change at commits of this PR

throw new LibresignException('Parameter id is required!', 400);
}
$names[$item['id']]['value'] = $this->trimAndThrowIfEmpty($item['id'], $item['value']);
$names[$item['id']]['value'] = trim((string)$item['value']);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe would be best create a fallback issue to implement a NormalizeService class to add the trim rule into all values and also add an uppercase rule into Country and maintain the scope of this PR more amalgamated with the issue that motivated this PR.

@vitormattos vitormattos changed the title chore: scenary validate test chore: Improvements at response from API when generate root certificate Sep 1, 2025
@vitormattos vitormattos merged commit 29392a3 into main Sep 1, 2025
59 checks passed
@vitormattos vitormattos deleted the chore/correct-validate-field branch September 1, 2025 14:49
@github-project-automation github-project-automation bot moved this from 1. to do to 4. to release in Roadmap Sep 1, 2025
@vitormattos
Copy link
Member

/backport to stable31

@vitormattos
Copy link
Member

/backport to stable30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants