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

server: Update query parameters for configurations #70

Merged

Conversation

bhufmann
Copy link
Contributor

@bhufmann bhufmann commented Sep 6, 2024

PR based on PR #66, which commits are included.

An additional commit is added:

  • server: Update query parameters for configurations

This commit also includes improved swagger updates of related topics.

Signed-off-by: Bernd Hufmann [email protected]

@bhufmann bhufmann changed the title Json schema 2 json if server: support json object in query parameters for configurations Sep 6, 2024
@bhufmann bhufmann force-pushed the json-schema-2-json-if branch 4 times, most recently from b629159 to f42d8ec Compare September 9, 2024 20:17
@bhufmann bhufmann force-pushed the json-schema-2-json-if branch 2 times, most recently from 5e53655 to 3ca5be9 Compare September 16, 2024 12:24
@bhufmann bhufmann force-pushed the json-schema-2-json-if branch 3 times, most recently from 897c200 to 81ddcd2 Compare September 23, 2024 23:45
@bhufmann bhufmann changed the title server: support json object in query parameters for configurations server: Update query parameters for configurations Oct 16, 2024
@Schema(required = true, description = "Parameters to create a configuration. Use optional key `name` for unique name of the configuration. "
+ "Use optional key `description` to provide a description of the configuration. Use optional key `typeId` to specify the configuration source type. "
+ "The typeId is not required if endpoint URI contains the typeId. Use key `properties` to specify JSON parameters according the JSON schema of"
+ "the corresponding ConfigurationTypeDescriptor. If no JSON schema is used, add the properties directly as key value pairs. Use key `path` for file URI string values.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what are pros and cons of describing them here vs. explicitly as in RequestedQueryParameters? I think with the latter they will be shown when expanding the parameters in the generated TSP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand. Using something RequestedQueryParameters and I tried it. The issues I had is the different ways we supply the custom properties:

  1. through JSON schema. This requires the properties key.
  2. directly under parameters (e.g. path for custom XML analysis in global configuration)

I had the following. It works well with 1). Do you know how can we support case 2)?

public interface ConfigurationQueryParameters {

    /**
     * @return The parameters.
     */
    @NonNull
    @Schema(required = true)
    ConfigurationParameters getParameters();

    /**
     * No expected properties below, as per current trace-server protocol.
     */
    interface ConfigurationParameters {
        @JsonProperty("name")
        @Schema(description = "Optional, unique name of the configuration. If omitted a unique name will be generated.")
        String getName();
        @JsonProperty("description")
        @Schema(description = "Optional, description of the configuration.")
        String getDescription();
        @Schema(description = "Optional, typeId of the configuration. Omit if it's part of endpoint URI.")
        @JsonProperty("typeId")
        String getTypeId();
        @JsonProperty("properties")
        @Schema(description = "Properties as JSON object as specified in the schema of the corresponding ConfigurationTypeDescriptor. Use key `path` for file URI string values.")
        Map<String, Object> getProperties();
    }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

The 'properties' could also be used for global configuration?
It could be as specified in a schema or in a list of paramDescriptors.
We should set the 'required' value for each parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 'properties' could also be used for global configuration? It could be as specified in a schema or in a list of paramDescriptors. We should set the 'required' value for each parameter.

Sounds good. Thanks for the feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Map<String, Object> parameters = config.getParameters();
assertNotNull(parameters);
Map<String, Object> jsonMap = config.getParameters();
assertNotNull(jsonMap);
Copy link
Contributor

Choose a reason for hiding this comment

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

These two lines just duplicates of the two lines above them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good eye. Done.

/**
* @return properties map as defined in the corresponding {@link ConfigurationSourceType}
*/
String getTypeId();
Copy link
Contributor

Choose a reason for hiding this comment

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

This line should be moved above the javadoc block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

ConfigurationParameters getParameters();

/**
* No expected properties below, as per current trace-server protocol.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

/**
* @return properties map as defined in the corresponding {@link ConfigurationSourceType}
*/
@Schema(required = true, description = "Properties as specified in the schema or list of ConfigurationParameterDescriptor of the corresponding ConfigurationTypeDescriptor.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking about it a bit more we should call this parameters instead of properties, because the resulting Configuration has a member called parameters instead of properties. It would be not clear otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm OK with that change.

This commit also includes improved swagger updates of related topics.

Signed-off-by: Bernd Hufmann <[email protected]>
@bhufmann bhufmann merged commit 6b6fd23 into eclipse-tracecompass-incubator:master Oct 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants