springfox.documentation.service.AllowableListValues Java Examples

The following examples show how to use springfox.documentation.service.AllowableListValues. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwaggerConfiguration.java    From ci-droid with Apache License 2.0 5 votes vote down vote up
private void actionToReplicateSpecificConfig(ModelContext modelContext) {
    Map actionToReplicateProperties = new HashMap<String, ModelProperty>();

    List<String> availableActionClassNames=availableActions.stream().map(a -> a.getClass().getCanonicalName()).collect(toList());

    ModelProperty actionToReplicateClassNameProperty=new ModelPropertyBuilder().required(true)
            .allowEmptyValue(false)
            .name("fully qualified class name identifier")
            .description("fully qualified name of the class implementing com.societegenerale.cidroid.api.actionToReplicate.ActionToReplicate")
            .allowableValues(new AllowableListValues(availableActionClassNames,"string"))
            .example((Object)"com.societegenerale.cidroid.extensions.actionToReplicate.OverwriteStaticFileAction")
            .type(resolver.resolve(String.class)).build();
    actionToReplicateClassNameProperty.updateModelRef(modelRefFactory(modelContext, typeNameExtractor));

    actionToReplicateProperties.put("@class",actionToReplicateClassNameProperty);


    ModelProperty actionToReplicateAttributeProperty=new ModelPropertyBuilder().required(true)
            .allowEmptyValue(false)
            .name("example of attribute")
            .description("depends on the @class picked. See in GET /cidroid-actions/availableActions , which classes you can use, and what are the expected fields for each")
            .type(resolver.resolve(String.class)).build();
    actionToReplicateAttributeProperty.updateModelRef(modelRefFactory(modelContext, typeNameExtractor));

    actionToReplicateProperties.put("someActionAttribute",actionToReplicateAttributeProperty);

    modelContext.getBuilder()
            .properties(actionToReplicateProperties)
            .description("see the Jackson config and the subclasses of in https://github.com/societe-generale/ci-droid-internal-api/blob/master/src/main/java/com/societegenerale/cidroid/api/actionToReplicate/ActionToReplicate.java");

}
 
Example #2
Source File: SwaggerConfiguration.java    From ci-droid with Apache License 2.0 5 votes vote down vote up
private void abstractGitHubInteractionSpecificConfig(ModelContext modelContext) {
    Map abstractGitHubInteractionProperties=new HashMap<String, ModelProperty>();

    ModelProperty abstractGitHubInteractionClassNameProperty=new ModelPropertyBuilder().required(true)
            .allowEmptyValue(false)
            .name("class identifier")
            .allowableValues(new AllowableListValues(
                    Arrays.asList(".DirectPushGitHubInteraction",".PullRequestGitHubInteraction"),"string"))
            .example((Object)".DirectPushGitHubInteraction")
            .type(resolver.resolve(String.class)).build();
    abstractGitHubInteractionClassNameProperty.updateModelRef(modelRefFactory(modelContext, typeNameExtractor));
    abstractGitHubInteractionProperties.put("@c",abstractGitHubInteractionClassNameProperty);


    ModelProperty branchNameProperty=new ModelPropertyBuilder().required(false)
            .name("branch name in case of PR")
            .description("when @c=.PullRequestGitHubInteraction, then we need to provide the name of the branch in which we want to the PR")
            .example((Object)"myBranch")
            .type(resolver.resolve(String.class)).build();
    branchNameProperty.updateModelRef(modelRefFactory(modelContext, typeNameExtractor));
    abstractGitHubInteractionProperties.put("branchNameToCreate",branchNameProperty);


    ModelProperty prTitleProperty=new ModelPropertyBuilder().required(false)
            .name("title of the PR")
            .description("when @c=.PullRequestGitHubInteraction, then we can provide a title for the PR. If not provided, the PR title will be the same as the branch name")
            .example((Object)"'[XYZ-123] adding a feature'")
            .type(resolver.resolve(String.class)).build();
    prTitleProperty.updateModelRef(modelRefFactory(modelContext, typeNameExtractor));
    abstractGitHubInteractionProperties.put("pullRequestTitle",prTitleProperty);

    modelContext.getBuilder()
            .properties(abstractGitHubInteractionProperties)
            .description("see the Jackson config in https://github.com/societe-generale/ci-droid-internal-api/blob/master/src/main/java/com/societegenerale/cidroid/api/gitHubInteractions/AbstractGitHubInteraction.java");
}
 
Example #3
Source File: ParameterAllowableValuesPlugin.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(ParameterContext parameterContext) {
    String name = parameterContext.getOperationContext().getName();
    switch (name) {
        case "getClientOptions":
        case "generateClient":
            parameterContext.parameterBuilder().allowableValues(new AllowableListValues(clients, "string"));
            break;
        case "getServerOptions":
        case "generateServerForLanguage":
            parameterContext.parameterBuilder().allowableValues(new AllowableListValues(servers, "string"));
    }
}