Skip to content

combining all api elements into a single repository #1

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

Merged
merged 36 commits into from
Oct 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e18a904
chore: moving server events
jarrodek Oct 9, 2021
8439b64
chore: moving @api-components/amf-helper-mixin
jarrodek Oct 9, 2021
9f0ce0c
chore: moving the http-method-label element
jarrodek Oct 10, 2021
e520a3a
chore: moving API demo page
jarrodek Oct 10, 2021
95b69f9
chore: moving API navigation
jarrodek Oct 10, 2021
795b15a
chore: moving schema / example genrators here
jarrodek Oct 10, 2021
f446835
docs: adding api schema docs page
jarrodek Oct 10, 2021
1ceb5d8
refactor: renamig selected to domainId on the editors
jarrodek Oct 10, 2021
e0767c0
fix: partial model support in the request editor
jarrodek Oct 10, 2021
d2fd82f
reactor: removing unused methods from the AMF mixin
jarrodek Oct 10, 2021
2afe239
chore: adding endpoint events and the logic to the store
jarrodek Oct 11, 2021
17d515e
ci: removing Windows from tests
jarrodek Oct 12, 2021
da9f22f
chore: adding tests from api-security-documentation
jarrodek Oct 12, 2021
917101c
chore: adding tests for the sec requirement element
jarrodek Oct 12, 2021
b59575d
chore: adding API Console demo
jarrodek Oct 13, 2021
748d54e
chore: adding types
jarrodek Oct 13, 2021
bcc0654
chore: updating documentation
jarrodek Oct 13, 2021
6c7a1d3
chore: adding api-documentation tests
jarrodek Oct 14, 2021
da8c55d
test: fixing tests after markup change
jarrodek Oct 14, 2021
de7a267
chore: restoring schema media selector
jarrodek Oct 14, 2021
67e8834
chore: updating demo dark theme
jarrodek Oct 14, 2021
647003b
feat: adding demo's AMF parser
jarrodek Oct 14, 2021
e539c71
chore: adding API editor experience
jarrodek Oct 15, 2021
a6ed02c
chore: minor improvements
jarrodek Oct 15, 2021
6a3dbfb
chore: updating demo styles
jarrodek Oct 15, 2021
0d55bb9
chore: migrating summary element to use the store
jarrodek Oct 15, 2021
800cf65
chore: upgrading to the new components
jarrodek Oct 21, 2021
71bf8aa
chore: moving components registration to define/ folder
jarrodek Oct 21, 2021
de806ec
chore: finalizing migration to the AmfStore
jarrodek Oct 23, 2021
17bf469
chore: working on partial store example
jarrodek Oct 23, 2021
0a33ba6
feat: adding support for local graph context
jarrodek Oct 23, 2021
c27e4ce
feat: adding support for custom sec query string
jarrodek Oct 23, 2021
c03255e
chore: redesigning the navigation
jarrodek Oct 23, 2021
7113f2d
chore: adding navigation layout options
jarrodek Oct 23, 2021
6fb7ff8
fix: fixing security tests
jarrodek Oct 23, 2021
6e480d1
chore: finishing the navigation
jarrodek Oct 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 20 additions & 20 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,31 @@ jobs:
run: npm ci
- name: Run tests
run: npm test
test_win:
name: "Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: microsoft/playwright-github-action@v1
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
# test_win:
# name: "Windows"
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 14
# - uses: microsoft/playwright-github-action@v1
# - uses: actions/cache@v1
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
# - name: Install dependencies
# run: npm ci
# - name: Run tests
# run: npm test
tag:
name: "Publishing release"
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
needs:
- test_linux
- test_win
# - test_win
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
40 changes: 40 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,63 @@
{
"cSpell.words": [
"amfstoreapiprotocols",
"amfstoreapisummary",
"amfstoreapiversion",
"amfstoredocumentationget",
"amfstoredocumentationlist",
"amfstoredocumentmeta",
"amfstoreendpointbypath",
"amfstoreendpointget",
"amfstoreendpointlist",
"amfstoreopget",
"amfstoreopgetparent",
"amfstorepayloadget",
"amfstorerequestget",
"amfstoreresponseget",
"amfstoresecurityget",
"amfstoresecuritygetrequirement",
"amfstoresecuritygetsettings",
"amfstoresecuritylist",
"amfstoretypeget",
"amfstoretypelist",
"apierror",
"apinavigate",
"apinavigateexternal",
"apirequest",
"apiresponse",
"apiserverchanged",
"apistorechange",
"apistoregraphchange",
"apistoreserverquery",
"Applian",
"Arrable",
"contentinfo",
"dompurify",
"fasttext",
"formdata",
"graphload",
"httpbin",
"itemschange",
"mimechange",
"monostate",
"Nexmo",
"notryit",
"onapiserverchange",
"onserverscountchange",
"openedchange",
"populateannotatedfields",
"preconnect",
"redirecturichange",
"Renderable",
"securitysettingsinfochanged",
"serverscountchanged",
"signedup",
"stevetest",
"telemetryevent",
"telemetryexception",
"telemetryscreenview",
"telemetrysocial",
"telemetrytiming",
"Tryit",
"Unionable",
"xone"
Expand Down
184 changes: 168 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,173 @@
# Changelog

## ApiResourceDocumentElement (former api-endpoint-documentation)
## Old components vs this repository

The `api-resource-document` element has the following properties changes compared to deprecated `api-endpoint-documentation`
### User (consumer) changelog

- `noTryIt` is renamed to `tryItButton`. When `tryItButton` is set then the try it button in operations is rendered.
The UI in most cases is consistent with the previous version, except for the following items:

- Removed an option to disable a single parameter. The rationale is that these parameters are defined in the API and the request editor and the outgoing HTTP request should reflect what the API author designed.
- Changes titles of operations and resource: added sub title describing the section.
- The URI and query parameters are now combined into a single section: Parameters.
- The information architecture for parameters changed for better readability and accessibility.
- Schema documentation was redesigned to better visualize complex objects.
- Authorization now support OpenID Connect which can be defined in an OAS file.

### Developer changelog

#### General changes

The `compatibility` has been renamed to `anypoint`.

The `selected` property has been renamed to `domainId` which is the id of the graph node rendered by the AMF parser.

The `selectedType` has been renamed to `domainType`. This is a value generated by the navigation element to help to reduce the scope of searching for an object in the graph model.

The components do not read the generated graph model anymore (generated through the AMF library LD+JSON model). See **docs/architecture.md** for detailed description.

#### Documentation components

##### Api navigation

The API navigate event definition changed. With this version the detail object has the following properties.

- domainId (`string`) The domain id (graph id) of the selected object.
- domainType (`summary` | `resource` | `operation` | `schema` | `security` | `documentation`) The type of the selected domain object.
- parentId (`string`) Optional, the parent object domain id (for an operation it is an endpoint)
- passive: (`boolean`) Optional, whether the selection came from the system processing rather than user interaction.

The navigation event is now `apinavigate` and can be dispatched by using `NavigationEvents` interface:

```javascript
import { Events } from '@api-components/amf-components';

Events.Navigation.apiNavigate(document.body, 'amf://id', 'resource');
```

##### ApiDocumentationElement (former api-documentation)

###### Refactored properties

- `selected` -> `domainId`
- `selectedType` -> `domainType`
- `inlineMethods` -> `tryItPanel`
- `compatibility` -> `anypoint`

###### Removed properties

- `noTryIt` - this has been replaced with `tryItButton`
- `noUrlEditor` - this has been replaced with `httpUrlEditor`
- `narrow` - no longer needed
- `scrollTarget` - no longer needed
- `graph` - not ever used
- `outlined` - we are dropping support for this property
- `noBottomNavigation` - not used anymore

###### New properties

- `tryItButton` - the opposite of the previous `noTryIt`
- `httpUrlEditor` - passed to the request editor as `urlEditor`
- `httpApplyAuthorization` - passed to the request editor as `applyAuthorization`
- `httpCredentialsSource` - passed to the request editor as `credentialsSource`

##### ApiResourceDocumentElement (former api-endpoint-documentation)

###### Refactored properties

- `selected` -> `domainId`
- `selectedType` - `domainType`
- `compatibility` - `anypoint`
- `noTryIt` - this has been replaced with `tryItButton`
- `inlineMethods` is renamed to `tryItPanel`. Has the same function.
- `noUrlEditor` is now renamed to `urlEditor`. When `urlEditor` is set then the HTTP request editor renders the URL editor input field.

## ApiOperationDocumentElement (former api-operation-documentation)
###### Removed properties

- `apiVersion` - no longer in use
- `endpointUri` - no longer in use
- `server` - no longer in use
- `endpointName` - no longer in use
- `description` - no longer in use
- `path` - no longer in use
- `hasCustomProperties` - no longer in use
- `narrow` - no longer in use
- `extendsTypes` - no longer in use
- `parentType` - no longer in use
- `parentTypeName` - no longer in use
- `traits` - no longer in use
- `previous` - no longer in use
- `next` - no longer in use
- `scrollTarget` - no longer in use
- `operations` - no longer in use
- `hasOperations` - no longer in use
- `outlined` - no longer in use
- `graph` - no longer in use
- `noNavigation` - no longer in use

###### New properties

- `serverId` the domain id of the selected API server.
- `operationId` - the domain id of the selected API operation, when `tryItPanel` is set.
- `tryItPanel` - renders the HTTP editors next to the operation. Former `inlineMethods`.
- `tryItButton` - the opposite of the previous `noTryIt`
- `httpUrlEditor` - passed to the request editor as `urlEditor`
- `httpApplyAuthorization` - passed to the request editor as `applyAuthorization`
- `httpCredentialsSource` - passed to the request editor as `credentialsSource`
- `httpNoServerSelector` - passed to the request editor as `noServerSelector`
- `asyncApi` - indicates the rendered API is an async API.

##### ApiOperationDocumentElement (former api-operation-documentation)

###### Refactored properties

- `tryIt` is renamed to `tryItButton`
- `tryItButton` is always set to `false` when `tryItPanel` is set on the resource document element.

## Authorization

### Configuration and HTTP request
- `method` is now `operation` which accepts serialized API operation model.
- `endpoint` now accepts serialized API endpoint model.
- `compatibility` -> anypoint

###### Removed properties

- `methodName` - no longer in use
- `httpMethod` - no longer in use
- `apiVersion` - no longer in use
- `endpointUri` - no longer in use
- `description` - no longer in use
- `hasCustomProperties` - no longer in use
- `expects` - no longer in use
- `server` - no longer in use
- `serverVariables` - no longer in use
- `endpointVariables` - no longer in use
- `hasPathParameters` - no longer in use
- `queryParameters` - no longer in use
- `hasParameters` - no longer in use
- `payload` - no longer in use
- `headers` - no longer in use
- `returns` - no longer in use
- `security` - no longer in use
- `narrow` - no longer in use
- `previous` - no longer in use
- `next` - no longer in use
- `extendsTypes` - no longer in use
- `traits` - no longer in use
- `graph` - no longer in use
- `methodSummary` - no longer in use
- `noNavigation` - no longer in use
- `ignoreBaseUri` - no longer in use
- `protocol` - no longer in use

###### New properties

- `serverId` the domain id of the selected API server.
- `tryItButton` - the opposite of the previous `noTryIt`
- `asyncApi` - indicates the rendered API is an async API.
- `requestMimeType` - The mime type of rendered request.

#### Request editor components

##### Authorization

###### Configuration and HTTP request

The authorization has been moved into this library and has a new API surface.

Expand All @@ -32,33 +184,33 @@ To maximize the compatibility with 0.2.0 use the following configuration:
></api-request-editor>
```

## Caching values
##### Caching values

The editor has a new boolean property `globalCache`. Once set it instruct the caching mechanism to cache user input in memory. The cached values are kept in memory even when API spec change.
Use the `src/lib/InputCache.js` class to manipulate the cache programmatically when needed.

When the `globalCache` is not set then the values are stored in a reference to the editor element. After removing the element from the DOM all cached properties are GC'd.

## Request editor
##### Request editor

### Refactor
###### Refactor

- `serializeRequest()` -> `serialize()`
- removed option `allowDisableParams`

### Setting URL values (baseUri, protocols, server)
###### Setting URL values (baseUri, protocols, server)

With version `0.2.x` it was possible to set `server`, `baseUri`, and `protocols` properties so the component is able to compute the endpoint URL without having the `server` value read from the AMF graph model. This turned out to be a feature that is not used so it is removed in `0.3.0`. Use `baseUri` to override any value defined in the servers.
Note, when `baseUri` is set it takes precedence over any other URI configuration (like a selected server).

## URL editor
##### URL editor

The URL editor is optional by default. The input won't be rendered until the `urlEditor` property is set.
For a better user experience do not set this option unless crucial for the application. To give user a feedback when updating parameters use option `urlLabel`.

Additionally, the user entered values are now updated on input value change rather than user input. This reduces UI changes (especially with URL editor enabled) while typing value into the editor.

## Body editor
##### Body editor

The body editor has been re-created from scratch. The new editor uses monaco editor to render the body input.
This requires loading monaco environment before the editor is rendered and activated.
Expand All @@ -77,7 +229,7 @@ await MonacoLoader.monacoReady(); // waits until all libraries are loaded.

Note, Monaco does not support encapsulation. Once loaded a global `Monaco` variable is created.

## Events
#### Events

With this version the following events are deprecated:

Expand Down Expand Up @@ -107,6 +259,6 @@ window.addEventListener(EventTypes.Request.apiRequest, (e) => {
RequestEvents.apiRequest(window, { /* the request definition */ });
```

## Tests
#### Tests

The tests for Firefox currently fails because `playwright` uses a previous version of the browser which has no support for ES modules in web workers. However, the current version support them. Firefox is temporarily removed from tests.
Loading