adobe / spacecat-api-service

Edge Delivery services experience success as a service automation: SpaceCat + Star Catalogue
Apache License 2.0
3 stars 1 forks source link

fix: cannot create a new import job without options #356

Closed swetabar closed 1 week ago

swetabar commented 2 weeks ago

Description The options object is an optional property in the JSON request body, but currently it is required in order to start a new import job.

To Reproduce

$ curl -v -H "x-api-key: $SPACECAT_API_KEY" -H "x-import-api-key: $IMPORT_API_KEY" -H "Content-Type: application/json" \ --request POST --data '{ "urls": ["https://www.test.com/page1.html", "https://www.test.com/page2.html"] }' \ https://spacecat.experiencecloud.live/api/ci/tools/import ... < HTTP/2 500 ... < x-error: Invalid options: undefined

Expected behavior An import job should be able to be created without this object, and the default values for all options should be assumed in its absence.

Solution We allow the end user to start a new import job without the options attribute. In case, the end user does not provide the options property, its default value is picked up from the IMPORT_CONFIGURATION environment variable.

Related Issues

353

github-actions[bot] commented 2 weeks ago

This PR will trigger a patch release when merged.

swetabar commented 2 weeks ago

Nice idea using the importConfiguration for the default/fallback options 👍. I wonder if we want to, eventually, provide a fallback for each option param, or if having those defaults set on the content scraper side will suffice? (Just a thought — no immediate change required)

Agreed. Having a fallback for each option param sounds good. We can make that once once we have a confirmed set of option attributes.

solaris007 commented 1 week ago

:tada: This PR is included in version 1.47.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: