sailpoint-oss / api-specs

This repo houses the API specifications for all SailPoint services.
MIT License
9 stars 15 forks source link

Invalid OpenAPI Specification for SailPoint IIQ using OpenAPI Generator #61

Open svenmaerki opened 4 months ago

svenmaerki commented 4 months ago

Description

I attempted to generate Java classes for SailPoint IdentityIQ (IIQ) using the provided OpenAPI specification, but encountered an issue due to an invalid specification. It's quite frustrating when the schema isn't valid as it impedes the development process and consumes valuable time.

Expected Behavior

The OpenAPI specification should conform to the standard and be valid according to the OpenAPI Specification version 3.0.3.

Actual Behavior

When attempting to generate Java classes using the provided OpenAPI specification, the process fails due to validation errors, indicating that the specification is not properly formatted or contains errors.

OpenAPI Generator Configuration in pom.xml

<execution>
<execution>
    <id>identityiq-api</id>
    <goals>
        <goal>generate</goal>
    </goals>
    <configuration>
        <inputSpec>
            ${project.parent.basedir}/api/src/main/openapi/external/sailpoint-identityiq.yaml
        </inputSpec>
        <generatorName>java</generatorName>
        <library>webclient</library>
        <invokerPackage>ch.svenmaerki.selfservead.domain.integration.identityiq</invokerPackage>
        <apiPackage>ch.svenmaerki.selfservead.domain.integration.identityiq.api</apiPackage>
        <modelPackage>ch.svenmaerki.selfservead.domain.integration.identityiq.model</modelPackage>
        <modelNameSuffix>To</modelNameSuffix>
    </configuration>
</execution>

Error Output

[INFO] --- openapi-generator:7.2.0:generate (selfservead-api) @ app ---
[INFO] Generating with dryRun=false
[INFO] Output directory (/Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi) does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.
[INFO] OpenAPI Generator: spring (server)
[INFO] Generator 'spring' is considered stable.
[INFO] ----------------------------------
[INFO] Set base package to invoker package (ch.svenmaerki.selfservead.rest)
[INFO] Environment variable JAVA_POST_PROCESS_FILE not defined so the Java code may not be properly formatted. To define it, try 'export JAVA_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[INFO] NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to true (--enable-post-process-file for CLI).
[INFO] Skipping generation of Webhooks.
[INFO] writing file /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi/pom.xml
[INFO] writing file /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi/README.md
[INFO] writing file /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi/src/main/java/ch/svenmaerki/selfservead/rest/api/ApiUtil.java
[INFO] writing file /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi/.openapi-generator-ignore
[INFO] writing file /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi/.openapi-generator/VERSION
[INFO] writing file /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/app/target/generated-sources/openapi/.openapi-generator/FILES
################################################################################
 Thanks for using OpenAPI Generator.
 Please consider donation to help us maintain this project 🙏
 https://opencollective.com/openapi_generator/donate
################################################################################
[INFO] 
[INFO] --- openapi-generator:7.2.0:generate (identityiq-api) @ app ---
[WARNING] /Users/svenmaerki/dev/projects/IdeaProjects/SelfServeAD/api/src/main/openapi/external/sailpoint-identityiq.yaml [0:0]: unexpected error in Open-API generation
org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 19, Warning count: 35
Errors: 
        -attribute components.schemas.taskResultByIdGetBody.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Applications/{applicationId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.SailPoint-Entitlement-Schema.items is missing
        -attribute components.schemas.entitlementByIdGetBody.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.applicationResponse.items is missing
        -attribute components.schemas.taskResultGetResponse.items is missing
        -attribute paths.'/TaskResults/{taskResultId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements/{entitlementId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.roleResponse.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Roles/{roleId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.entitlementGetResponse.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/json'.schema.items is missing
Warnings: 
        -attribute components.schemas.taskResultByIdGetBody.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Applications/{applicationId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.SailPoint-Entitlement-Schema.items is missing
        -attribute components.schemas.entitlementByIdGetBody.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.applicationResponse.items is missing
        -attribute components.schemas.taskResultGetResponse.items is missing
        -attribute paths.'/TaskResults/{taskResultId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements/{entitlementId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.roleResponse.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Roles/{roleId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.entitlementGetResponse.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/json'.schema.items is missing

    at org.openapitools.codegen.config.CodegenConfigurator.toContext (CodegenConfigurator.java:701)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput (CodegenConfigurator.java:728)
    at org.openapitools.codegen.plugin.CodeGenMojo.execute (CodeGenMojo.java:913)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
[ERROR] 
org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 19, Warning count: 35
Errors: 
        -attribute components.schemas.taskResultByIdGetBody.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Applications/{applicationId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.SailPoint-Entitlement-Schema.items is missing
        -attribute components.schemas.entitlementByIdGetBody.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.applicationResponse.items is missing
        -attribute components.schemas.taskResultGetResponse.items is missing
        -attribute paths.'/TaskResults/{taskResultId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements/{entitlementId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.roleResponse.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Roles/{roleId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.entitlementGetResponse.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/json'.schema.items is missing
Warnings: 
        -attribute components.schemas.taskResultByIdGetBody.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Applications/{applicationId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Applications'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.SailPoint-Entitlement-Schema.items is missing
        -attribute components.schemas.entitlementByIdGetBody.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute components.schemas.applicationResponse.items is missing
        -attribute components.schemas.taskResultGetResponse.items is missing
        -attribute paths.'/TaskResults/{taskResultId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements/{entitlementId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.roleResponse.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Roles'(get).responses.200.content.'application/scim+json'.schema.items is missing
        -attribute paths.'/Roles/{roleId}'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute components.schemas.entitlementGetResponse.items is missing
        -attribute paths.'/TaskResults'(get).responses.200.content.'application/json'.schema.items is missing
        -attribute paths.'/Entitlements'(get).responses.200.content.'application/json'.schema.items is missing
svenmaerki commented 4 months ago

Has this been recognized?