Unable to reuse externally loaded OpenAPI object (open SpecSource instantiation?)

Issue #409 new
Marc LEVISSE created an issue

Our project uses OpenAPI specs for many purposes : validation (for which we use your lib) but also for specific business related behaviors

In order to do both, we load OpenAPI specs at app startup, using your OpenAPI object, retrieve some specific “X-custom” properties for further usage, and then pass loaded OpenAPI object to init OpenApiInteractionValidator

Though, as SpecSource can currently not be instantiated outside of OpenApiInteractionValidator (nor retrieved after validator is initialized), we were forced to copy OpenApiLoader locally, customizing it to load specs from a custom source.

Should it be possible to open a little bit the SpecSource object creation shortcut methods so that we can use your existing OpenApiLoader ? (SpecSource itself is already public)

        private static SpecSource unknown(final String specUrlOrPayload) { //should become public ?
            return new SpecSource(specUrlOrPayload, Type.UNKNOWN);
        }

        private static SpecSource inline(final String inlineApiSpec) {//should become public ?
            return new SpecSource(inlineApiSpec, Type.INLINE_SPEC);
        }

        private static SpecSource specUrl(final String specUrl) {//should become public ?
            return new SpecSource(specUrl, Type.SPEC_URL);
        }

Thx a lot for your feedback !

Comments (0)

  1. Log in to comment