Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
RAGO - RAG OpenAPI Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
RAGO - RAG OpenAPI Framework
Commits
3621a1af
Commit
3621a1af
authored
3 years ago
by
Jueun Park
Browse files
Options
Downloads
Patches
Plain Diff
Added javadoc for RandomRequestGenerator
parent
a64b569e
No related branches found
No related tags found
1 merge request
!6
Resolve "check and fix random request generator"
Pipeline
#13303
failed
3 years ago
Stage: build
Stage: test
Stage: ragdoc
Stage: publish
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/jastadd/RandomRequestGenerator.jrag
+25
-1
25 additions, 1 deletion
src/main/jastadd/RandomRequestGenerator.jrag
with
25 additions
and
1 deletion
src/main/jastadd/RandomRequestGenerator.jrag
+
25
−
1
View file @
3621a1af
...
...
@@ -83,6 +83,10 @@ aspect RandomRequestGenerator{
}
}
/**
* Checks which schema type the parameter has (String or Integer) and generates parameters.
* @return A generated Path parameter.
*/
syn String ParameterObject.randomPathParameter(String pathRef){
SchemaObject s = getSchema().schemaObject();
String pathPart = pathRef.substring(pathRef.indexOf("{"), pathRef.indexOf("}") + 1);
...
...
@@ -97,6 +101,10 @@ aspect RandomRequestGenerator{
return pathRef;
}
/**
* Checks which schema type the parameter has (String or Integer) and generates parameters.
* @return A generated Query parameter.
*/
syn String ParameterObject.randomQueryParameter(String pathRef){
SchemaObject s = getSchema().schemaObject();
...
...
@@ -121,6 +129,10 @@ aspect RandomRequestGenerator{
return pathRef;
}
/**
* Generates a random String value.
* @return A random String.
*/
public String ParameterObject.generateRandomString(JastAddList<EnumObj> objs){
Random rand = new Random();
if (objs.getNumChild() != 0)
...
...
@@ -133,6 +145,10 @@ aspect RandomRequestGenerator{
.toString();
}
/**
* Generates a random Integer value.
* @return A random Integer.
*/
public String ParameterObject.generateRandomInt(int minimum,int maximum){
Random rand = new Random();
if (minimum > -1 && maximum > 0)
...
...
@@ -144,17 +160,25 @@ aspect RandomRequestGenerator{
return String.valueOf(rand.nextInt());
}
/**
* Generates a random value of Enum.
* @return A random value of Enum.
*/
public String ParameterObject.pathWithEnum(EnumObj e, String pathRef){
Random rand = new Random();
return rand.nextDouble() < 0.5 ?
pathRef + "&" + this.getName() + "=" + e.getEnumOb() : pathRef;
}
/**
* This is a method to avoid the duplication of Urls.
* @return The list of Urls.
*/
syn String OpenAPIObject.getURLFromGeneratedURLs(List<String> urls, String ref){
for( String url : urls ){
if( url.contains(ref) )
return url;
}
return
nul
l;
return
ur
l;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment