Comments (16)
I'll run the example and get back
from cats.
@rahulahoop this is fixed in the last commit and will be released this week.
from cats.
Ok I've built the jar from source and now Im getting the error stack trace.
i softlinked the jar so i can run it anywhere but the first stack trace i got was file not found becuase im giving the file relative to the dir im in, so like in the example
dir
- spec
$dir cats.jar --contract=spec
if i provide full PWD then he finds the file.
Then he cant interpret references to other yaml files and throws a npe:
[**********][*****] Exception while resolving:
java.lang.RuntimeException: Unable to load RELATIVE ref: ./schemas/shared.yaml path: .
at io.swagger.v3.parser.util.RefUtils.readExternalRef(RefUtils.java:239)
is this not supported?
from cats.
@rahulahoop Is it possible to post an example? It seems that the openapi parser has issues with this. I didn't test this scenario yet, so it will be helpful to see what's missing. It might be some additional parser configuration that's needed.
from cats.
attached is a sample of referencing the path
produces the same error
from cats.
its correct in reading from an external file, perhaps its the path
am i incorrect in providing the full qualified path for the contract?
from cats.
@rahulahoop you should put $ref: './shared/extra.yaml/#/components/schemas/NotAccessible'
. Please notice the ./
at the start.
from cats.
@en-milie i still get runtime exception with the same error
from cats.
I run CATS as:
./cats.jar --contract=contract.yaml --server=http://localhost:8200
The contract.yaml looks as follows:
openapi: "3.0.2"
info:
title: API Title
version: "1.0"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
'200':
description: OK
components:
schemas:
InFileObject:
type: object
properties:
Acessable:
type: string
OutFileObject:
$ref: './shared/extra.yaml/#/components/schemas/NotAccessible'
And I get a full run:
☑ complete CATS finished in 2151 ms. Total (excluding skipped) requests 66. ✔ Passed 3, ⚠ warnings: 22, ‼ errors: 41,
@rahulahoop am I missing something?
from cats.
@rahulahoop can I close this? or still having issues?
from cats.
I am still having an issue but Im not sure how I can recreate it.
I moved the jar to folder of my specification and he starts to fuzz with happyfuzzer but gets a null pointer on endpoint that looks like this
[**********][*****] ▶ start Start fuzzing path /statistics/bk/{subtype}
[**********][*****] ✖ error Something went wrong while running CATS!
java.lang.NullPointerException: null
at com.endava.cats.generator.simple.PayloadGenerator.parseFromInnerSchema(PayloadGenerator.java:338)
/statistics/bk/{subtype}:
get:
summary: Return statistics for BK case
description: Returns the yearly statistics for BK cases. If no search parameter is given the
current year will be used.
operationId: get-statistics-bk
parameters:
- in: path
name: subtype
required: true
schema:
$ref: 'schemas/statistics-reports.yaml#/components/schemas/StatisticBKSubtype'
- name: year
in: query
required: false
schema:
type: integer
tags:
- statistics
- BK
responses:
200:
$ref: '#/components/responses/StatisticDataResponse'
404:
description: No statistics for chosen year found
i tried to make a smaller replica case for this but its not getting npe so im a little bit confused
from cats.
@rahulahoop will you be able to post the schemas as well? both of them? (anonymised, of course)
from cats.
@en-milie sure i think its with the subtype tho
StatisticBKSubtype:
type: string
enum:
- UNKNOWN
- GRANT
- REJECT
- INQUERY
responses:
StatisticDataResponse:
description: Returns the statistics for the chosen year
content:
application/json:
schema:
$ref: 'schemas/statistics-reports.yaml#/components/schemas/StatisticYear'
# another file...
StatisticYear:
type: object
properties:
year:
type: integer
months:
type: array
items:
$ref: '#/components/schemas/StatisticMonth'
maxItems: 12
default: []
required:
- year
- months
from cats.
@rahulahoop I did a run with the following schemas and didn't reproduce the problem. From the exception you mentioned above it seems that you use anyOf
or oneOf
with a discriminator. Can you also let me know where is that used?
statistics.yaml
openapi: "3.0.2"
info:
title: API Title
version: "1.0"
servers:
- url: https://api.server.test/v1
paths:
/statistics/bk/{subtype}:
get:
summary: Return statistics for BK case
description: Returns the yearly statistics for BK cases. If no search parameter is given the
current year will be used.
operationId: get-statistics-bk
parameters:
- in: path
name: subtype
required: true
schema:
$ref: 'schemas/statistics-reports.yaml#/components/schemas/StatisticBKSubtype'
- name: year
in: query
required: false
schema:
type: integer
tags:
- statistics
- BK
responses:
200:
$ref: '#/components/responses/StatisticDataResponse'
404:
description: No statistics for chosen year found
components:
responses:
StatisticDataResponse:
description: Returns the statistics for the chosen year
content:
application/json:
schema:
$ref: 'schemas/statistics-reports.yaml#/components/schemas/StatisticYear'
statistics-reports.yaml:
openapi: "3.0.2"
info:
title: API Title
version: "1.0"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
'200':
description: OK
components:
schemas:
StatisticMonth:
type: object
properties:
month:
type: integer
day:
type: integer
StatisticYear:
type: object
properties:
year:
type: integer
months:
type: array
items:
$ref: '#/components/schemas/StatisticMonth'
maxItems: 12
default: [ ]
required:
- year
- months
StatisticBKSubtype:
type: string
enum:
- UNKNOWN
- GRANT
- REJECT
- INQUERY
from cats.
@rahulahoop can I close this one? and maybe open a new one for the issue(s) you are facing?
from cats.
@en-milie sure thats a good idea
from cats.
Related Issues (20)
- [FunctionalFuzzer] Warning on nullable enum HOT 2
- [Bug]: Path parameters are not fuzzed for PUT/PATCH/POST methods HOT 6
- MinimumExactNumbersInNumericFieldsFuzzer MaximumExactNumbersInNumericFieldsFuzzer fuzzers fuzz values as "string" not as schema data type HOT 3
- NullPointerException when traing to run app HOT 3
- CountryCode regex pattern is not honoured HOT 3
- Very long string is getting generated for "zip" (zip code/pin code) field HOT 3
- Ip Address value is not generated properly HOT 2
- Regex match on --path HOT 1
- java.lang.IllegalArgumentException When header.yaml file is given as input HOT 5
- Link fuzzer reports with actual vulnerabilities HOT 2
- README has not got enough information. HOT 1
- The project structure seems a bit confusing HOT 2
- execution handling in readme file HOT 1
- README translation HOT 1
- For some spec files cyclic redundancy check goes into infinite loop HOT 3
- Error when fuzzing `Expected to find an object with property ['th'] in path $['th'] but found 'net.minidev.json.JSONArray'` HOT 2
- windows : i use command java -jar cats.jar on the cmd . but there is nothing ! HOT 1
- Does exist a Docker compose example with something like PetClinic to test the cats? HOT 1
- `java.lang.NullPointerException` when fuzzing HOT 5
- No option to specify how long should fuzzer runs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cats.