Skip to content
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(create, init): create INPUT.json from input_schema prefills #379

Merged
merged 9 commits into from Jul 3, 2023

Conversation

monkey-denky
Copy link
Contributor

Example

From input_schema.json:

{
    "title": "PlaywrightCrawler Template",
    "type": "object",
    "schemaVersion": 1,
    "properties": {
        "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "URLs to start with.",
            "editor": "requestListSources",
            "prefill": [
                {
                    "url": "https://apify.com"
                }
            ]
        }
    }
}

To INPUT.json

{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ]
}

@monkey-denky monkey-denky added adhoc Ad-hoc unplanned task added during the sprint. t-web Issues with this label are in the ownership of the web team. labels Jun 26, 2023
@monkey-denky monkey-denky added this to the 66th sprint - Web team milestone Jun 26, 2023
@monkey-denky monkey-denky self-assigned this Jun 26, 2023
src/lib/create-utils.js Outdated Show resolved Hide resolved
src/lib/create-utils.js Outdated Show resolved Hide resolved
Copy link
Member

@mtrunkat mtrunkat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one thing - I am afraid that with just prefills without defaults the INPUT might be invalid in some cases.

Definitely for some Actors, maybe not for templates at the current state, but we will have to be careful about this.

src/lib/create-utils.js Outdated Show resolved Hide resolved
src/lib/create-utils.js Outdated Show resolved Hide resolved
src/lib/create-utils.js Outdated Show resolved Hide resolved
Copy link
Member

@drobnikj drobnikj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two points

  1. Can we reuse logic to prefill input from console/api?
  2. This is good candidate for test

@monkey-denky
Copy link
Contributor Author

monkey-denky commented Jun 30, 2023

  • After a discussion with @fnesveda I added the prefilled INPUT.json functionality to both init and create.
  • The logic for prefill is copied for now from the console. In the future, we should move the method apify-shared-js package and use it from there.
  • added tests
  • TEMPLATE CHANGES -> some tests needed fixing mainly due to the location of the src/main.js

Copy link
Member

@fnesveda fnesveda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one note

src/lib/input_schema.js Show resolved Hide resolved
Copy link
Member

@drobnikj drobnikj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one note

src/lib/input_schema.js Show resolved Hide resolved
Copy link
Member

@fnesveda fnesveda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny thing about the error handling

src/lib/input_schema.js Outdated Show resolved Hide resolved
@monkey-denky
Copy link
Contributor Author

@fnesveda I will be on vacation next week so if you guys approve this feel free to merge it

@mtrunkat mtrunkat removed their request for review July 3, 2023 08:21
@jbartadev jbartadev changed the title feat(create): create INPUT.json from input_schema prefills feat(create, init): create INPUT.json from input_schema prefills Jul 3, 2023
@jbartadev jbartadev merged commit 45a99ac into master Jul 3, 2023
17 checks passed
@jbartadev jbartadev deleted the feat/apify-create-input-json branch July 3, 2023 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adhoc Ad-hoc unplanned task added during the sprint. t-web Issues with this label are in the ownership of the web team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants