1.1.15 • Published 1 year ago
@dmdata/telegram-json-types v1.1.15
@dmdata/telegram-json-types
概要
DMDATA.JP が提供する JSON Schema の、TypeScript型定義を公開しています。
使い方
インストール
$ npm i -D @dmdata/telegram-json-types
型の使用
import { EarthquakeInformation } from '@dmdata/telegram-json-types';
const data = await fetch('https://data.api.dmdata.jp/v1/...')
.then(res => res.json()) as Promise<EarthquakeInformation.Latest.Main>
JSON Schema による整合性チェック
Telegram JSON が、仕様通り整合するかチェックができます。
$ npm i @dmdata/telegram-json-types ajv
import { getJSchema } from '@dmdata/telegram-json-types';
// 実際の電文データ
const telegramData = {
_schema: {
type: 'earthquake-information',
version: '1.1.0'
}
};
async function check() {
// Schema 名から JSON Schema 定義を読み込む
const jschema = await getJSchema(telegramData._schema.type, telegramData._schema.version);
const validate = ajv.complite(jschema);
console.log(validate(telegramData)); // false
}
check();
使える型定義
- EarthquakeInformation
- EarthquakeExplanation
- EarthquakeCounts
- EarthquakeHypocenterUpdate
- EarthquakeNankai
- EewInformation
- Forecast2weekTemperature
- ForecastPrefecture
- ForecastSeason
- ForecastWarningPossibility
- ForecastWeathermap
- TsunamiInformation
- VolcanoInformation
- WeatherInformation
- WeatherImpactSociety
- WeatherEarly
- WeatherWarning
- WeatherTornado
- WeatherTyphoon
- WeatherLandslide
- WeatherRiverFlood
1.1.15
1 year ago
1.1.14
1 year ago
1.1.12
2 years ago
1.1.13
2 years ago
1.1.11
3 years ago
1.1.9
3 years ago
1.1.8
3 years ago
1.1.10
3 years ago
1.1.7
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.9-jschema.0
3 years ago
1.0.8
3 years ago
1.0.9-jschema.1
3 years ago
1.0.7
3 years ago
1.1.5
3 years ago
1.0.6
3 years ago
1.1.4
3 years ago
1.0.5
3 years ago
1.1.3
3 years ago
1.1.2
3 years ago
1.0.9-jschema.2
3 years ago
1.0.9-jschema.3
3 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago