Skip to content

Conversation

@Guitlle
Copy link
Contributor

@Guitlle Guitlle commented Dec 12, 2025

🗒️ Checklist

  1. run linter locally
  2. update developer docs (API, README, inline, etc.), if any
  3. for user-facing doc changes create a Zulip thread at #Support Docs Updates, if any
  4. draft PR with a title <type>(<scope>)<!>: <title> DEV-1234
  5. assign yourself, tag PR: at least Front end and/or Back end or workflow
  6. fill in the template below and delete template comments
  7. review thyself: read the diff and repro the preview as written
  8. open PR & confirm that CI passes & request reviewers, if needed
  9. delete this section before merging

📣 Summary

Add OpenAPI schema for the /api/v2/assets/{uid_asset}/advanced-features/ endpoint.

📖 Description

The API schema output files and the generated Orval types have been updated with the schema details for the action parameters in the QuestionAdvancedFeature model.

@Guitlle Guitlle self-assigned this Dec 12, 2025
@Guitlle Guitlle added API Changes related to API endpoints Back end labels Dec 12, 2025
@Guitlle Guitlle marked this pull request as ready for review December 12, 2025 23:59
open_api_201_created_response,
)
from kpi.utils.viewset_mixins import AssetNestedObjectViewsetMixin
from kpi.versioning import APIV2Versioning
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's specify the custom lookup_field, i.e.:

lookup_field = 'uid_advanced_feature'

parameters=[
OpenApiParameter(
name='uid',
name='id',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use the name custom lookup_field uid_advanced_feature instead.

type=str,
location=OpenApiParameter.PATH,
required=True,
description='UID of the action',
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe action is not really accurate in this context?

parameters=[
OpenApiParameter(
name='uid',
name='id',
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the name

},
'options': {'type': 'object'},
},
'required': ['uuid', 'type', 'labels'],
Copy link
Contributor

Choose a reason for hiding this comment

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

We should enforce that choices should be present only when type is qualSelectMultiple or qualSectionOne.

require_auth=False,
raise_access_forbidden=False,
),
examples=get_advanced_features_create_examples(),
Copy link
Contributor

Choose a reason for hiding this comment

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

The examples of the response seems wrong. I assume they should match the list.

raise_access_forbidden=False,
validate_payload=False,
),
examples=get_advanced_features_list_examples(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Some examples are missing (manual transcription, automatic google translation).
If you did it in purpose, let's add a description with your example and make the example more generic.

See Delete NLP action for supplement details "

Image

Moreover, the examples are showing a double nested list.

[  
  [
    {
      "action": "manual_translation",
      "question_xpath": "q1",
      "params": [
        {
          "language": "es"
        }
      ],
      "uid": "qa123456789AbCdEfGhIjklm"
    }
  ]
]

)
@extend_schema_view(
create=extend_schema(
description=read_md('subsequences', 'subsequences/create.md'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the markdowns. They could be simplified thanks to the examples you have added to this PR. (e.g. no need to explain what params should look like anymore in the markdown, the examples do the trick).

],
examples=get_advanced_features_update_examples(),
),
retrieve=extend_schema(
Copy link
Contributor

Choose a reason for hiding this comment

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

The example is wrong , is misleading.

Image

Let's reuse examples of the list. Consider to use the description of the example like describe previously for Delete NLP action for supplement details

examples=get_advanced_features_list_examples(),
),
partial_update=extend_schema(
description=read_md('subsequences', 'subsequences/update.md'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as for "retrieve" .

Moreover, I'm not sure to understand the labels of the examples. Many are missing too.

Comment on lines +15 to +34
def _get_action_refs(cls, registry):
nlp_component = ResolvedComponent(
name='NLPActionParams',
schema=cls._get_nlp_params_schema(),
type=ResolvedComponent.SCHEMA,
object=dict,
)
registry.register_on_missing(nlp_component)
qual_component = ResolvedComponent(
name='QualActionParams',
schema=cls._get_qual_params_schema(),
type=ResolvedComponent.SCHEMA,
object=dict,
)
registry.register_on_missing(qual_component)

return [
nlp_component.ref,
qual_component.ref,
]
Copy link
Contributor

Choose a reason for hiding this comment

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

I created a mixin in #6535 for that purpose. Let's refactor the code when both branches are merged

name='NLPActionParams',
schema=cls._get_nlp_params_schema(),
type=ResolvedComponent.SCHEMA,
object=dict,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's expect dict here. If you look at drf-spectular code, it's used to detect collision based on object.__class__ , so it returns  type all the time for dict.

Not a big deal, though!

What do you think?
(I personaly used the instance of the OpenApiSerializerExtension class).

…a-for-advanded-features

 # Conflicts:
 #	jsapp/js/api/models/advancedFeaturePostRequestParamsItem.ts
 #	jsapp/js/api/models/advancedFeatureResponseParamsItem.ts
 #	jsapp/js/api/models/assetAdvancedSubmissionSchema.ts
 #	jsapp/js/api/models/assetAnalysisFormJsonEngines.ts
 #	jsapp/js/api/models/dataSupplementResponse.ts
 #	jsapp/js/api/models/nLPActionParamsItem.ts
 #	jsapp/js/api/models/patchedAdvancedFeaturePatchRequestParamsItem.ts
 #	jsapp/js/api/models/patchedDataSupplementPayload.ts
 #	jsapp/js/api/models/patchedDataSupplementPayloadOneOfOneOfQualOneOfAllOf.ts
 #	jsapp/js/api/models/qualActionParamsItemChoicesItemLabels.ts
 #	static/openapi/schema_v2.json
 #	static/openapi/schema_v2.yaml
@noliveleger noliveleger changed the title feat(subsequences): add openapi schema for advanded features DEV-1230 feat(subsequences): add OpenAPI schema for advanded features DEV-1230 Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Changes related to API endpoints Back end

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants