Skip to content

Commit

Permalink
Adding typespec-azure-portal-core package (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
yejee94 authored Feb 7, 2024
1 parent 2b10ece commit 1db11c2
Show file tree
Hide file tree
Showing 23 changed files with 1,031 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-bobcats-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@azure-tools/typespec-azure-portal-core": none
---

adding typespec-azure-portal-core lib
1 change: 1 addition & 0 deletions .chronus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ versionPolicies:
packages:
- "@azure-tools/typespec-autorest"
- "@azure-tools/typespec-azure-core"
- "@azure-tools/typespec-azure-portal-core"
- "@azure-tools/typespec-azure-resource-manager"
- "@azure-tools/typespec-client-generator-core"
ignore:
Expand Down
41 changes: 41 additions & 0 deletions docs/libraries/typespec-azure-portal-core/reference/data-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: "Data types"
toc_min_heading_level: 2
toc_max_heading_level: 3
---

# Data types

## Azure.Portal

### `AboutOptions` {#Azure.Portal.AboutOptions}

Options for about of ARM resource.

```typespec
model Azure.Portal.AboutOptions
```

### `BrowseOptions` {#Azure.Portal.BrowseOptions}

Options for browse of ARM resource.

```typespec
model Azure.Portal.BrowseOptions
```

### `FilePath` {#Azure.Portal.FilePath}

File path of a file

```typespec
model Azure.Portal.FilePath
```

### `marketplaceOfferOptions` {#Azure.Portal.marketplaceOfferOptions}

Options for marketplaceOffer

```typespec
model Azure.Portal.marketplaceOfferOptions
```
81 changes: 81 additions & 0 deletions docs/libraries/typespec-azure-portal-core/reference/decorators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: "Decorators"
toc_min_heading_level: 2
toc_max_heading_level: 3
---

# Decorators

## Azure.Portal

### `@about` {#@Azure.Portal.about}

Provides a Model describing about of ARM resource.

```typespec
@Azure.Portal.about(options: Azure.Portal.AboutOptions)
```

#### Target

`Model`

#### Parameters

| Name | Type | Description |
| ------- | --------------------------------- | ------------------------------------------------------------------------ |
| options | `model Azure.Portal.AboutOptions` | Property options allows more detailed infomation about the resourceType. |

### `@browse` {#@Azure.Portal.browse}

Provides a Model customizing browse view of ARM resource.

```typespec
@Azure.Portal.browse(options: Azure.Portal.BrowseOptions)
```

#### Target

`Model`

#### Parameters

| Name | Type | Description |
| ------- | ---------------------------------- | ------------------------------------------------------------------- |
| options | `model Azure.Portal.BrowseOptions` | Property options provides browsing information of the resourceType. |

### `@displayName` {#@Azure.Portal.displayName}

Provides a Model Property a display name

```typespec
@Azure.Portal.displayName(name: valueof string)
```

#### Target

`ModelProperty`

#### Parameters

| Name | Type | Description |
| ---- | ----------------------- | ----------- |
| name | `valueof scalar string` | |

### `@marketplaceOffer` {#@Azure.Portal.marketplaceOffer}

Provides a Model marketplace offer information of ARM resource.

```typespec
@Azure.Portal.marketplaceOffer(options: Azure.Portal.marketplaceOfferOptions)
```

#### Target

`Model`

#### Parameters

| Name | Type | Description |
| ------- | -------------------------------------------- | ---------------------------------------------------------------------------- |
| options | `model Azure.Portal.marketplaceOfferOptions` | Property options provides marketplace offer information of the resourceType. |
50 changes: 50 additions & 0 deletions docs/libraries/typespec-azure-portal-core/reference/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: Overview
sidebar_position: 0
toc_min_heading_level: 2
toc_max_heading_level: 3
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Overview

TypeSpec Azure Portal Core library

## Install

<Tabs>
<TabItem value="spec" label="In a spec" default>

```bash
npm install @azure-tools/typespec-azure-portal-core
```

</TabItem>
<TabItem value="library" label="In a library" default>

```bash
npm install --save-peer @azure-tools/typespec-azure-portal-core
```

</TabItem>
</Tabs>

## Azure

## Azure.Portal

### Decorators

- [`@about`](./decorators.md#@Azure.Portal.about)
- [`@browse`](./decorators.md#@Azure.Portal.browse)
- [`@displayName`](./decorators.md#@Azure.Portal.displayName)
- [`@marketplaceOffer`](./decorators.md#@Azure.Portal.marketplaceOffer)

### Models

- [`AboutOptions`](./data-types.md#Azure.Portal.AboutOptions)
- [`BrowseOptions`](./data-types.md#Azure.Portal.BrowseOptions)
- [`FilePath`](./data-types.md#Azure.Portal.FilePath)
- [`marketplaceOfferOptions`](./data-types.md#Azure.Portal.marketplaceOfferOptions)
7 changes: 7 additions & 0 deletions packages/typespec-azure-portal-core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require("@typespec/eslint-config-typespec/patch/modern-module-resolution");

module.exports = {
plugins: ["@typespec/eslint-plugin"],
extends: ["@typespec/eslint-config-typespec", "plugin:@typespec/eslint-plugin/recommended"],
parserOptions: { tsconfigRootDir: __dirname, project: "tsconfig.config.json" },
};
90 changes: 90 additions & 0 deletions packages/typespec-azure-portal-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# @azure-tools/typespec-azure-portal-core

TypeSpec Azure Portal Core library

## Install

```bash
npm install @azure-tools/typespec-azure-portal-core
```

## Decorators

### Azure.Portal

- [`@about`](#@about)
- [`@browse`](#@browse)
- [`@displayName`](#@displayname)
- [`@marketplaceOffer`](#@marketplaceoffer)

#### `@about`

Provides a Model describing about of ARM resource.

```typespec
@Azure.Portal.about(options: Azure.Portal.AboutOptions)
```

##### Target

`Model`

##### Parameters

| Name | Type | Description |
| ------- | --------------------------------- | ------------------------------------------------------------------------ |
| options | `model Azure.Portal.AboutOptions` | Property options allows more detailed infomation about the resourceType. |

#### `@browse`

Provides a Model customizing browse view of ARM resource.

```typespec
@Azure.Portal.browse(options: Azure.Portal.BrowseOptions)
```

##### Target

`Model`

##### Parameters

| Name | Type | Description |
| ------- | ---------------------------------- | ------------------------------------------------------------------- |
| options | `model Azure.Portal.BrowseOptions` | Property options provides browsing information of the resourceType. |

#### `@displayName`

Provides a Model Property a display name

```typespec
@Azure.Portal.displayName(name: valueof string)
```

##### Target

`ModelProperty`

##### Parameters

| Name | Type | Description |
| ---- | ----------------------- | ----------- |
| name | `valueof scalar string` | |

#### `@marketplaceOffer`

Provides a Model marketplace offer information of ARM resource.

```typespec
@Azure.Portal.marketplaceOffer(options: Azure.Portal.marketplaceOfferOptions)
```

##### Target

`Model`

##### Parameters

| Name | Type | Description |
| ------- | -------------------------------------------- | ---------------------------------------------------------------------------- |
| options | `model Azure.Portal.marketplaceOfferOptions` | Property options provides marketplace offer information of the resourceType. |
65 changes: 65 additions & 0 deletions packages/typespec-azure-portal-core/lib/decorators.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import "../dist/src/index.js";

using TypeSpec.Reflection;
namespace Azure.Portal;

/**
* Provides a Model describing about of ARM resource.
* @param options Property options allows more detailed infomation about the resourceType.
*/
extern dec about(target: Model, options: AboutOptions);

/**
* Provides a Model customizing browse view of ARM resource.
* @param options Property options provides browsing information of the resourceType.
*/
extern dec browse(target: Model, options: BrowseOptions);

/**
* Provides a Model marketplace offer information of ARM resource.
* @param options Property options provides marketplace offer information of the resourceType.
*/
extern dec marketplaceOffer(target: Model, options: marketplaceOfferOptions);

/**
* Provides a Model Property a display name
*/
extern dec displayName(target: ModelProperty, name: valueof string);

// this decorator will be available in next iteration
//extern dec essentials(target: ModelProperty);

/** Options for browse of ARM resource. */
model BrowseOptions {
/** argQuery can be a literal string query or KQL file path.
* KQL query which represents all possible data for your desired browse view.
*/
argQuery?: string | FilePath;
}

/** File path of a file */
model FilePath {
/** File path of a file */
filePath: string;
}

/** Options for marketplaceOffer */
model marketplaceOfferOptions {
/** Marketplace offer id of a resource */
id?: string;
}

/** Options for about of ARM resource. */
model AboutOptions {
/** Icon which represent resource */
icon?: FilePath;

/** Display name which represent the resource */
displayName?: string;

/** Comma-separated set of words or phrases which allow users to search for your asset by identifiers. */
keywords?: string[];

/** Set of links which can help learn more about the resource */
learnMoreDocs?: string[];
}
1 change: 1 addition & 0 deletions packages/typespec-azure-portal-core/lib/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./decorators.tsp";
Loading

0 comments on commit 1db11c2

Please sign in to comment.