Skip to content

modify query_params and path_params class names #8

Open
@brunnels

Description

@brunnels

Is there a way to change how the query_params and path_params class names are generated without modifying the parser?

I would like them to be named with the camelcase endpoint name plus the suffix.

Example of what I get now:

    def get_field_values(
        self,
        path_params: FieldNamePathParams,
        query_params: XmlNodeNameParameter1Parameter2Parameter3QueryParams
    ) -> GetFieldValuesResponse:
        """Get Field Values"""
        return self.get(Endpoints.get_field_values, query_params)

what I want:

    def get_field_values(
            self, 
            path_params: GetFieldValuesPathParams,
            query_params: GetFieldValuesQueryParams
    ) -> GetFieldValuesResponse:
        """Get Field Values"""
        return self.get(Endpoints.get_field_values, query_params)

This is how I get it now but would rather not modify the library.

Change https://github.com/mom1/apiclient-pydantic-generator/blob/master/apiclient_pydantic_generator/parser.py#L320

operation_name = re.sub('(?i)response$', '', self._temporary_operation.get('response'))
original_name = self._get_model_name(operation_name, '', suffix=suffix)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions