-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: unit test and linting for cts generation APIC-277 #103
Conversation
@@ -3,9 +3,143 @@ import fsp from 'fs/promises'; | |||
import SwaggerParser from '@apidevtools/swagger-parser'; | |||
import type { OpenAPIV3 } from 'openapi-types'; | |||
|
|||
import { removeObjectName, walk } from '../../utils'; | |||
import { removeEnumType, removeObjectName, walk } from '../../utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain to me what this enum type thing is? is it java related? if it is, what if we split data processing part per language? because this seems irrelevant to JS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not just enum related, this will take all arguments like:
{
"test1": "hello",
"other": [{
"test2": 4
}]
}
And convert it to:
{
"test1": {
"value": "hello",
"isArray": false,
"isObject": false,
"isInteger": false,
"isString": true,
...
},
"other": {
"value": [{
"value": {
"test2": {
"value": 4,
"isArray": false,
"isObject": false,
"isInteger": true,
"isString": false,
...
},
"isArray": false,
"isObject": true,
"isInteger": false,
"isString": false,
...
},
"isArray": false,
"isObject": true,
"isInteger": false,
"isString": false,
...
}],
"isArray": true,
"isObject": false,
"isInteger": false,
"isString": false,
...
}
}
recursively, which is the common way to handle complex objects in mustache (openapi does the same augmentation).
This attribute parametersWithDataType
will be the one used in all typed languages, the exception is actually js that don't need all that and can do fine just with the json representation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I saw that adds a bunch of helper variables for mustache. I was just wondering what removeEnumType
function does :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to remove all type decoration and leave raw json, for languages that don't support enum or don't need them
🧭 What and Why
🎟 JIRA Ticket: APIC-277
Changes included:
🧪 Test
CI