Skip to content

Arazzo Parser v1#1568

Open
daniellopera15 wants to merge 26 commits into
WebFuzzing:masterfrom
daniellopera15:feature/arazzo-parser
Open

Arazzo Parser v1#1568
daniellopera15 wants to merge 26 commits into
WebFuzzing:masterfrom
daniellopera15:feature/arazzo-parser

Conversation

@daniellopera15

Copy link
Copy Markdown

No description provided.

@jgaleotti jgaleotti self-requested a review June 9, 2026 20:57
@jgaleotti jgaleotti requested a review from arcuri82 June 9, 2026 21:18

@arcuri82 arcuri82 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hi @daniellopera15 thx for your first PR! ;)
see my comments.
sorry for delay, i was on a 2-week leave

Comment thread core/pom.xml Outdated
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why modifying this file as part of this PR?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was a mistake due to the IDE's formatting. Reverted.

Comment thread core-extra/arazzo-parser/pom.xml Outdated
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-core-extra</artifactId>
<version>5.1.1-SNAPSHOT</version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

update to 6.0.1-SNAPSHOT

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Comment thread core-extra/arazzo-parser/pom.xml Outdated
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.2.34</version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this version should not be here, but in a parent pom, where other swagger dependency are declared, ie., core-parent/pom.xml

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Comment thread core-extra/arazzo-parser/pom.xml Outdated
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-client-java-no-dependencies</artifactId>
<scope>compile</scope>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why a compile dependency for this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This dependency was removed because it had been added during a previous implementation of the tests that ultimately went unused.

Comment thread core-extra/arazzo-parser/pom.xml Outdated
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.2.34</version>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

use properties for repeated version numbers in the same dependency family

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

}

private static Pair<ArazzoSpecificationsDTO, JsonNode> parseSchemaText(String schemaText) {
String schemaTextClean = schemaText.replaceAll("^\\s+", "");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why is this needed? wouldn't Jackson handle it anyway?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The previous functionality was necessary to prevent errors. It was removed when the solution you suggested was implemented.

JsonNode arazzoJsonNode;

try {
if (schemaTextClean.startsWith("{")) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this check is potntially brittle. maybe use try/catch like:

    try {
        JSON_MAPPER.readValue(input, Object.class);
    } catch (JsonProcessingException e) {
        // Not valid JSON, try YAML
         YAML_MAPPER.readValue(input, Object.class);
    }

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

try {
if (schemaTextClean.startsWith("{")) {
arazzoSpecificationsDTO = JSON_MAPPER.readValue(schemaTextClean, ArazzoSpecificationsDTO.class);
arazzoJsonNode = JSON_MAPPER.readTree(schemaTextClean);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why is the file parsed twice? why having a POJO representation and a JsonNode at the same time?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

"arazzoSpecificationsDTO" is the parsed document. "arazzoJsonNode" is used to allow referencing via JsonNode when resolving references in ArazzoReferenceResolver.

String referenceClean = referenceWithoutComponents.substring((expectedPrefix + ".").length());
Object resolve;
switch (expectedPrefix) {
case "successActions":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all these hardcoded values like "successActions" should be put in some common constant

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

import org.junit.Assert;
import org.junit.Test;

public class ArazzoParserTest {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe not in this PR, but we will need more tests, eg, especially for all the code in the resolver

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It is a simple test to ensure functionality. The idea is to extend it to better tests.

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.

3 participants