Comments (3)
We just ran into a similar issue where we have a property required
on one of our objects.
from portman.
Doing some research on where/how to fix this. For a property named required
I see the exception during test generation looks like this:
/Users/tillig/specification/node_modules/@apideck/portman/dist/application/Fuzzer.js:497
var requiredFuzz = node.required.map(function (req) { return "" + requiredPath + req; });
^
TypeError: node.required.map is not a function
at Object.<anonymous> (/Users/tillig/specification/node_modules/@apideck/portman/dist/application/Fuzzer.js:497:50)
at walker (/Users/tillig/specification/node_modules/traverse/index.js:150:16)
at /Users/tillig/specification/node_modules/traverse/index.js:171:17
at Array.forEach (<anonymous>)
at forEach (/Users/tillig/specification/node_modules/traverse/index.js:19:30)
at walker (/Users/tillig/specification/node_modules/traverse/index.js:166:4)
at /Users/tillig/specification/node_modules/traverse/index.js:171:17
at Array.forEach (<anonymous>)
at forEach (/Users/tillig/specification/node_modules/traverse/index.js:19:30)
at walker (/Users/tillig/specification/node_modules/traverse/index.js:166:4)
at /Users/tillig/specification/node_modules/traverse/index.js:171:17
at Array.forEach (<anonymous>)
at forEach (/Users/tillig/specification/node_modules/traverse/index.js:19:30)
at walker (/Users/tillig/specification/node_modules/traverse/index.js:166:4)
at /Users/tillig/specification/node_modules/traverse/index.js:171:17
at Array.forEach (<anonymous>)
Working backwards, I can see that things start happening right around line 854 in Fuzzer.analyzeFuzzJsonSchema
with the required
issue happening specifically at line 888.
I'm not entirely sure how to fix that yet, but it looks like there are similar sections in there for other reserved words like minimum
, maxiumum
, maxLength
, minLength
, and nullable
.
from portman.
Looks like a failing Jest test is something like:
it('should analyse JSON schema of request body with properties named after reserved words for fuzz detection', async () => {
// Analyse JSON schema with properties that use reserved words
const schema = {
properties: {
nullable: {
type: 'object',
properties: {
required: {
type: 'object',
properties: {
minimum: {
type: 'object',
required: ['maxLength'],
properties: {
maxLength: {
type: 'number',
example: 1,
minimum: 1,
maximum: 100,
minLength: 1,
maxLength: 5
}
}
}
}
}
}
}
}
} as OpenAPIV3.SchemaObject
const result = fuzzer.analyzeFuzzJsonSchema(schema)
expect(result).toMatchSnapshot()
})
from portman.
Related Issues (20)
- excludeForOperations not behaving as expected HOT 3
- Publish 1.22.1 HOT 5
- Portman appears to still Pickup deprecated Api's HOT 3
- How to include common functions and headers that are sent for all requests via postman collection to the new collection generating via Portman HOT 8
- npx openapi-format command not found
- Provide casing options for the auto-generated name for assignVariables HOT 1
- how to validate API Parameters in a generic way for all APIs of a collection? HOT 4
- includeTests should include the default tests HOT 1
- Use local or remote JSON or YAML config files HOT 1
- $ref to other OAS file does not quite work as expected HOT 3
- Fuzzing Feature Request - Empty Required Parameter Tests HOT 19
- Unable to generate integration tests with colon character in URL HOT 3
- Query parameters should be enabled with overwrites in variation tests HOT 10
- Cannot get overwrites.*.overwriteRequestSecurity to work HOT 5
- Can Portman generate fuzzy parameter test cases to test dependencies keyword of json HOT 3
- ERR_INVALID_PROTOCOL - Protocol http not supported, expected https HOT 6
- If the API documentation has basic authorization HOT 2
- Any suggestions how to generate tests for invalid and blank values in request payload in fuzzy tests HOT 2
- headersPresent test should be generated only if response headers are required by the schema. HOT 7
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 portman.