-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add support for schemaBased editor in input schema #102
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: Add support for schemaBased editor in input schema #102
Conversation
package.json
Outdated
| { | ||
| "name": "apify-zapier-integration", | ||
| "version": "4.4.3", | ||
| "version": "4.5.0", |
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.
You do not need to commit version changes as it is updated based on created release.
| } catch (err) { | ||
| throw new Error(`${title} is not a valid JSON, please check it. Error: ${err.message}`); | ||
| } | ||
| case 'schemaBased': |
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.
If I have field like
"arrayObjectsSchemaBased": {
"title": "Request headers",
"type": "array",
"description": "Multiple objects via schemaBased.",
"editor": "schemaBased",
"items": {
"type": "object",
"properties": {
"name": {
"title": "Header name",
"type": "string",
"description": "Name of HTTP header.",
"editor": "textfield",
"minLength": 1
},
"value": {
"title": "Header value",
"type": "string",
"description": "Value of header.",
"editor": "textfield",
"minLength": 1
}
},
"required": ["name", "value"],
},
"minItems": 1,
"maxItems": 10
}
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.
Not sure why but title is not propagated into Zapier, input field
"objectSchemaBased": {
"title": "Advanced configuration",
"type": "object",
"description": "Object with defined sub-schema.",
"editor": "schemaBased",
"properties": {
"timeout": {
"title": "Timeout",
"type": "integer",
"description": "Timeout in seconds.",
"editor": "number",
"minimum": 1,
"maximum": 300
},
"locale": {
"title": "Locale",
"type": "string",
"description": "Locale string.",
"editor": "textfield",
"pattern": "^[a-z]{2,3}-[A-Z]{2}$"
},
"debugMode": {
"title": "Debug Mode",
"type": "boolean",
"description": "Enable verbose logging.",
"editor": "checkbox"
}
},
"required": ["timeout", "locale"],
},
|
@drobnikj thanks for the review. I have fixed the issue with arrays having
I think this is a bug in Zapier as it uses the |
Can you please report it here? |
drobnikj
left a comment
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.
Looks it works now, can you check last comments
src/creates/actor_run.js
Outdated
| getActorAdditionalFields, | ||
| maybeGetInputSchemaFromActor, | ||
| prefixInputFieldKey, | ||
| prefixInputFieldKey, slugifyText, |
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.
| prefixInputFieldKey, slugifyText, | |
| prefixInputFieldKey, | |
| slugifyText, |
| inputSchemaKeys.forEach((key) => { | ||
| const fieldKey = prefixInputFieldKey(key); | ||
| const value = bundle.inputData[fieldKey]; | ||
| const fieldTitle = prefixInputFieldKey(slugifyText(inputSchema.properties[key].title)); |
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 please comment this workaround and ideally reference the issue you created in Zapier repo about it?
|
Bug reported to Zapier: zapier/zapier-platform#1178 |
protoss70
left a comment
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.
I found this one issue where when I have 2 schemaBased editors and only the first one shows for me on the screen. I am attaching 2 pictures one from Zapier and one from the console and on Zapier they look like they are grouped together. I am also attaching a gist file of my input schema https://gist.github.com/protoss70/d13f112299e5b2c5e0b12d76c6843885.
The schema is built by @mfori
CONSOLE

|
@protoss70 Thank you for the review. I have made some changes to the implementation and tested it against the schema you provided. It should now work as we expect. |
drobnikj
left a comment
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.
Changes looks good to go, I just realize that we need to cover new editor in tests.
Could you please add some test case in https://github.com/apify/apify-zapier-integration/blob/master/test/helpers/index.js
|
That's a good point. I'll figure out some tests to cover all of this functionality. |
* refactor: Make sure all Actor mentions have uppercase A * fix: Fix input generation for multi-select enums
|
I have added a few test. Since I'm not sure that any of our public Actors are using this editor yet. I have implemented all of the tests using mocks. |
drobnikj
left a comment
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 looks there some unrelated changes like change log, not sure why.
Otherwise ok.



Links to #101.
This PR introduces support for the new input schema editor
schemaBased. Due to the limitation of the Zapier platform the nested input fields are only available for objects. Arrays still use text area input for directly writing the JSON string.The new input looks like this:
