Skip to content
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

Issue/1175/oas 3 enhance validation and random object generation ts #1325

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tschlat
Copy link
Collaborator

@tschlat tschlat commented Feb 25, 2025

Here's the third PR, introducing two main features:

  • RandomValueGenerator for generating random OpenAPI data.
  • OpenAPI Schema Validator leveraging com.atlassian.oai:swagger-request-validator-core for OpenAPI validation.

Provided in two commits to separate these concerns.

@tschlat tschlat requested review from bbortt and christophd February 25, 2025 16:56
@tschlat tschlat force-pushed the issue/1175/oas_3_enhance_validation_and_random_object_generation_TS branch from a4dd0f7 to 02f1675 Compare February 25, 2025 17:07
@bbortt
Copy link
Collaborator

bbortt commented Feb 27, 2025

- Enhance random object generation
- Enhance configuration options for OpenAPIActions
   - autofill
   - operation path

Co-authored-by: Timon Borter <[email protected]>
@tschlat tschlat force-pushed the issue/1175/oas_3_enhance_validation_and_random_object_generation_TS branch from 02f1675 to d5f0887 Compare February 28, 2025 20:53
@tschlat
Copy link
Collaborator Author

tschlat commented Mar 1, 2025

There was a dependency missing. Pipeline is green. Feel free to review.

@tschlat
Copy link
Collaborator Author

tschlat commented Mar 6, 2025

Any activities around this? So that we can move ahead?

@bbortt
Copy link
Collaborator

bbortt commented Mar 6, 2025

Any activities around this? So that we can move ahead?

52/104 files. 27 comments so far 😉

Copy link
Collaborator

@bbortt bbortt left a comment

Choose a reason for hiding this comment

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

finally the long awaited review 😉 hope it's all right. let me know if you have any questions or if I got something wrong...

}

public static boolean isGenerateOptionalFieldsGlobally() {
return parseBoolean(System.getProperty(GENERATE_OPTIONAL_FIELDS_PROPERTY, System.getenv(GENERATE_OPTIONAL_FIELDS_ENV) != null ?
Copy link
Collaborator

Choose a reason for hiding this comment

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

the SystemProvider makes this easily testable, but I think we've covered this discussion once before.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that would also solve the build error.. #1325 (comment) 😉

Object value = entry.getValue();

if ("ARRAY".equals(key)) {
appendObject(builder, value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

that is a bit irritating, because the method appendArray does also exist.

public class RandomNumberGenerator extends RandomGenerator {

public static final BigDecimal THOUSAND = new BigDecimal(1000);
public static final BigDecimal HUNDRED = java.math.BigDecimal.valueOf(100);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public static final BigDecimal HUNDRED = java.math.BigDecimal.valueOf(100);
public static final BigDecimal HUNDRED = new BigDecimal(100);

* @return a unique scenario id for the {@link OasOperation}
*/
public static String createFullPathOperationIdentifier(OasOperation oasOperation, String path) {
return createFullPathOperationIdentifier(oasOperation.getMethod().toUpperCase(), path);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return createFullPathOperationIdentifier(oasOperation.getMethod().toUpperCase(), path);
return createFullPathOperationIdentifier(oasOperation.getMethod(), path);

.toUpperCase() should be (and is being) done by the base-method.

@@ -0,0 +1,18 @@
package org.citrusframework.openapi;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this one is missing the copyright headers.

@@ -1,25 +1,23 @@
package org.citrusframework.openapi.actions;
Copy link
Collaborator

Choose a reason for hiding this comment

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

some more tests with missing copyright headers. there's this function in Intellij, where you can apply copyright headers to all files matching a glob pattern (e.g. **/*.java). maybe you should try it 😉 or I can do it, if you want me to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants