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

[ZEN-3764] Example Data: Generate example dummy data into OpenAPI Model from single schema (DO NOT MERGE) #487

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

nbhusare
Copy link
Contributor

@nbhusare nbhusare commented Mar 28, 2019

This PR add's support for providing example data in the KZOE editor, in the form of a proposal provider. It introduces a new extension point named com.reprezen.swagedit.core.exampleprovider. Plug-ins having a dependency on com.reprezen.swagedit.core can provide an extension to the aforementioned extension point. The extension receives a resolved schema instance as input, which can be used with libraries like Adobe Ride (model-util), JSON Schema Faker... to generate dummy data.

It also enhances the internal utility API by adding two new classes - ModelUtils and ExtensionUtils. ModelUtils has API for traversing the JSON Node model (AST) and retrieving nodes with a given name. The ExtensionUtils adds support for reading extension points.

JsonExampleProposalProvider is the base class of the newly introduced example providers for Swagger and OpenAPI 3.0. The implementations OpenApi3ExampleProposalProvider and SwaggerExampleProposalProvider provide intelligence of identifying the content assist location and retrieving the ExampleProvider implementation.

…nded in the studio in order to provide a dummy data provider for

json schema. The ExampleDataProvider is an interface that the implementation data provider would extend. The content assist processor binds
the new content assist extension. The ExampleDataContentASsistExt provides an extension to the content assist at position definitions/any.
The schemas folder is made available as part of the binary buld by adding it in the build file
nbhusare added 15 commits March 30, 2019 11:59
Updated the ExampleDataContentAssistExt class to get the Schema object and resolve it before passing to the extendion implementation
Added new Utility API namely ExtensionUtils and ModelUtils
…pi3ExampleProposalProvider which gets trigger when the user hits content assit at a location where

example or examples/example-name/value is required. It internally calls the ExampleDataProvider to get the example data. Reverted back the changes made to the existing codebase
Added copyright to new files
…oved to the swagedit.core project so that they can be reused in Swagger and OpenApi3 propesalproviders
Renamed the schema file too
Moved the ExamplePovider to the core.exampleprovider package inside the swagedit.core project
…gic from Swagger and OpenAPI3 proposal providers

Added separate Proposal providers for swagger and openapi3
ADded initial unit test- wip
Fixed merge conflicts in swagedit.core plugin.xml and the ExtensionUtils class
Renamed the extension point for example provider to c.r.swagedit.exampleprovider
Minor changes in the .exsd file
@@ -5,4 +5,5 @@ bin.includes = META-INF/,\
OSGI-INF/,\
plugin.xml,\
icons/,\
resources/
resources/,\
schema/
Copy link
Member

Choose a reason for hiding this comment

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

@nbhusare You should remove this schema it is making the build to fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants