2024-07-20 09:53:58 +01:00
@example @general
2024-05-26 15:58:33 +01:00
Feature : API Validation
2024-05-27 16:31:00 +01:00
@positive @password
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00
Scenario : Remove password
2024-05-26 15:58:33 +01:00
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e p d f c o n t a i n s 3 p a g e s
And t h e p d f i s e n c r y p t e d w i t h p a s s w o r d " p a s s w o r d 1 2 3 "
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| p a s s w o r d | p a s s w o r d 1 2 3 |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / s e c u r i t y / r e m o v e - p a s s w o r d "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / p d f "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 0
And t h e r e s p o n s e P D F i s n o t p a s s w o r d e d
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
2024-05-27 16:31:00 +01:00
@negative @password
2024-05-26 15:58:33 +01:00
Scenario : Remove password wrong password
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e p d f c o n t a i n s 3 p a g e s
And t h e p d f i s e n c r y p t e d w i t h p a s s w o r d " p a s s w o r d 1 2 3 "
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| p a s s w o r d | w r o n g P a s s w o r d |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / s e c u r i t y / r e m o v e - p a s s w o r d "
Then t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 500
2025-06-02 22:49:46 +01:00
And t h e r e s p o n s e s h o u l d c o n t a i n e r r o r m e s s a g e " J o b f a i l e d : o r g . a p a c h e . p d f b o x . p d m o d e l . e n c r y p t i o n . I n v a l i d P a s s w o r d E x c e p t i o n : C a n n o t d e c r y p t P D F , t h e p a s s w o r d i s i n c o r r e c t "
2024-05-26 15:58:33 +01:00
2024-05-27 16:31:00 +01:00
@positive @info
2024-05-26 15:58:33 +01:00
Scenario : Get info
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / s e c u r i t y / g e t - i n f o - o n - p d f "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / j s o n "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 100
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
2024-05-27 16:31:00 +01:00
@positive @password
2024-05-26 15:58:33 +01:00
Scenario : Add password
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e p d f c o n t a i n s 3 p a g e s
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| p a s s w o r d | p a s s w o r d 1 2 3 |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / s e c u r i t y / a d d - p a s s w o r d "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / p d f "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 100
And t h e r e s p o n s e P D F i s p a s s w o r d e d
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00
2024-05-27 16:31:00 +01:00
@positive @password
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00
Scenario : Add password with other params
2024-05-26 15:58:33 +01:00
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e p d f c o n t a i n s 3 p a g e s
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| o w n e r P a s s w o r d | o w n e r P a s s |
| p a s s w o r d | p a s s w o r d 1 2 3 |
| k e y L e n g t h | 2 5 6 |
| c a n P r i n t | t r u e |
| c a n M o d i f y | f a l s e |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / s e c u r i t y / a d d - p a s s w o r d "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / p d f "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 100
And t h e r e s p o n s e P D F i s p a s s w o r d e d
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00
2024-05-27 16:31:00 +01:00
@positive @watermark
2024-05-26 15:58:33 +01:00
Scenario : Add watermark
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e p d f c o n t a i n s 3 p a g e s
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| w a t e r m a r k T y p e | t e x t |
| w a t e r m a r k T e x t | S a m p l e W a t e r m a r k |
| f o n t S i z e | 3 0 |
| r o t a t i o n | 4 5 |
| o p a c i t y | 0 . 5 |
| w i d t h S p a c e r | 5 0 |
| h e i g h t S p a c e r | 5 0 |
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00
| a l p h a b e t | r o m a n |
| c u s t o m C o l o r | #d3d3d3 |
2024-05-26 15:58:33 +01:00
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / s e c u r i t y / a d d - w a t e r m a r k "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / p d f "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 100
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
2024-05-27 16:31:00 +01:00
@positive
2024-05-26 15:58:33 +01:00
Scenario : Remove blank pages
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e p d f c o n t a i n s 3 b l a n k p a g e s
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| t h r e s h o l d | 9 0 |
| w h i t e P e r c e n t | 9 9 . 9 |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / m i s c / r e m o v e - b l a n k s "
2024-08-03 10:44:17 +01:00
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / o c t e t - s t r e a m "
And t h e r e s p o n s e f i l e s h o u l d h a v e e x t e n s i o n " . z i p "
2024-08-03 13:47:47 +01:00
And t h e r e s p o n s e Z I P s h o u l d c o n t a i n 1 f i l e s
2024-05-26 15:58:33 +01:00
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 0
2024-05-27 16:31:00 +01:00
@positive @flatten
2024-05-26 15:58:33 +01:00
Scenario : Flatten PDF
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| f l a t t e n O n l y F o r m s | f a l s e |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / m i s c / f l a t t e n "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / p d f "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 0
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00
2024-05-27 16:31:00 +01:00
@positive @metadata
2024-05-26 15:58:33 +01:00
Scenario : Update metadata
Given I g e n e r a t e a P D F f i l e a s " f i l e I n p u t "
And t h e r e q u e s t d a t a i n c l u d e s
| p a r a m e t e r | v a l u e |
| a u t h o r | J o h n D o e |
| t i t l e | S a m p l e T i t l e |
| s u b j e c t | S a m p l e S u b j e c t |
| k e y w o r d s | s a m p l e , t e s t |
| p r o d u c e r | T e s t P r o d u c e r |
When I s e n d t h e A P I r e q u e s t t o t h e e n d p o i n t " / a p i / v 1 / m i s c / u p d a t e - m e t a d a t a "
Then t h e r e s p o n s e c o n t e n t t y p e s h o u l d b e " a p p l i c a t i o n / p d f "
And t h e r e s p o n s e f i l e s h o u l d h a v e s i z e g r e a t e r t h a n 0
And t h e r e s p o n s e P D F m e t a d a t a s h o u l d i n c l u d e " A u t h o r " a s " J o h n D o e "
And t h e r e s p o n s e P D F m e t a d a t a s h o u l d i n c l u d e " K e y w o r d s " a s " s a m p l e , t e s t "
And t h e r e s p o n s e P D F m e t a d a t a s h o u l d i n c l u d e " S u b j e c t " a s " S a m p l e S u b j e c t "
And t h e r e s p o n s e P D F m e t a d a t a s h o u l d i n c l u d e " T i t l e " a s " S a m p l e T i t l e "
And t h e r e s p o n s e s t a t u s c o d e s h o u l d b e 200
Improve Type Safety and OpenAPI Schema for PDF API Controllers and Models (#3470)
# Description of Changes
- **What was changed**
- Updated controller methods to use strongly‐typed primitives (`int`,
`long`, `boolean`) instead of `String` for numeric and boolean
parameters, eliminating calls to `Integer.parseInt`/`Long.parseLong` and
improving null‐safety (`Boolean.TRUE.equals(...)`).
- Enhanced all API request model classes with richer Swagger/OpenAPI
annotations: added `requiredMode`, `defaultValue`, `allowableValues`,
`format`, `pattern`, and tightened schema descriptions for all fields.
- Refactored HTML form templates for “Remove Blank Pages” to include
`min`, `max`, and `step` attributes on numeric inputs, matching the
updated validation rules.
- **Why the change was made**
- **Type safety & robustness**: Shifting from `String` to native types
prevents runtime parsing errors, simplifies controller logic, and makes
default values explicit.
- **Better API documentation & validation**: Enriching the Swagger
annotations ensures generated docs accurately reflect required fields,
default values, and permitted ranges, which improves client code
generation and developer experience.
- **Consistency across codebase**: Aligning all request models and
controllers enforces a uniform coding style and reduces bugs.
#3406
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-05-16 13:23:01 +02:00