Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
GoでWeb APIを作る - JSON Hyper-Schemaからいろいろ生成する
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
tutuming
August 24, 2015
Programming
3k
16
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GoでWeb APIを作る - JSON Hyper-Schemaからいろいろ生成する
2015.08.24 リブセンス様社内勉強会LT資料
tutuming
August 24, 2015
More Decks by tutuming
See All by tutuming
NSQのご紹介
tutuming
1
1.5k
Other Decks in Programming
See All in Programming
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
0
380
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
300
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
20
20k
iOSDCのペンライトを自動制御したい!
akkeylab
0
340
setup-vp GitLab対応の裏側
naokihaba
0
150
すこし踏み込む CancellationToken
htkym
2
1.6k
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
520
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
290
Intent as Code
shoppingjaws
6
1.1k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
iOSDC2026登壇資料.pdf
riofujimon
0
200
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.2k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
560
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
780
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
510
How Software Deployment tools have changed in the past 20 years
geshan
2
34k
Abbi's Birthday
coloredviolet
4
10k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
290
Transcript
GoͰWeb APIΛ࡞Δ JSON Hyper-Schema͔Β͍Ζ͍Ζੜ͢Δ @tutuming
ࣗݾհ • แ • @tutuming • גࣜձࣾ WACUL CTO
We are hiring!
ԿΛ࡞͍ͬͯΔ͔ • AIΞφϦετ • Google Analytics ࿈ܞ • ࣗಈղੳ •
αΠτͷ՝Λݟ͚ͭΔ We are hiring!
AIΞφϦετͷߏ • όοΫΤϯυ Go, MongoDB, Elasticsearch • ϑϩϯτΤϯυ TypeScript (CoffeeScript)
, AngularJS
Go ͬͯΔਓ !?
ࠓ͍͑ͨ͜ͱ REST API ΛGoͰ։ൃ͢Δͱ͖ • APIυΩϡϝϯτ • ܕఆٛ • όϦσʔγϣϯ
• ϋϯυϥͷͻͳܗ ͍Ζ͍Ζࣗಈੜ͢ΔͱḿΔΑ
Why Go? • εέʔϧ͢ΔΈ -> gorutine, channel • ੩తܕ͚ ->
มߋʹର͢Δ҆৺ײ • ίϯύΠϧҰॠ -> εΫϦϓτݴޠΈ͍ͨʹಈ͔ͤΔ • ϘτϜΞοϓͷจԽ
REST API with Go ΠϯλʔϑΣΠε(JSONͱͷϚοϐϯά)ఆٛͷͭΒΈ map[string]interface{} // ͓खܰ <-> ܕͷϝϦοτͳ͠
struct ఆٛ // ݎ࿚ <-> खͰॻ͘ͷ͠ΜͲ͍
ੜͨ͠Β͑͑Μ • JSON Hyper-Schema • http://json-schema.org/latest/json-schema- hypermedia.html • JSONͷܕఆٛɺόϦσʔγϣϯఆٛ •
+ Http্ͷϦιʔεఆٛ = REST ͜ΕͰʂ
͡ΌʔΜ schema.json ॻ͘ͷͭΒͨΜ 1ϑΝΠϧ 4000ߦ
prmd by heroku • https://github.com/interagent/prmd • YAMLͰ ෳϑΝΠϧʹ͚ͯཧͰ͖Δ • ->
1ͭͷschema.json ʹcombine • schema.json ͔Β υΩϡϝϯτੜͰ͖Δ
શମߏ
JSON ܕఆٛ
Go struct ੜ
Validator ੜ https://github.com/wcl48/valval
Ϧιʔεఆٛ
endpoint Έੜ ্ͷؔΛड͚औͬͯ ύϥϝʔλͷόϦσʔγϣϯ JSONͷੜͳͲΛߦ͏ॲཧΛroterʹઃఆ // GETύϥϝʔλ // PaymentͷϦετΛฦ͢
APIมߋϑϩʔ • YAMLॻ͘ • ఆٛɾυΩϡϝϯτੜ • ίϯύΠϧΤϥʔ͢ • ϩδοΫ࣮ •
ςετॻ͘
ར༻ऀͷ • υοτΛଧͬͨΒิ͕ग़ΔͷͰɺ伳ḜԌ͕࣏Γ·ͨ͠ (29ࡀ உੑ) • ܕ͕͋ΔͱϦϦʔεޙ҆৺ͯ͠Ε·͢ (29ࡀ உੑ) •
υΩϡϝϯτͱ࣮͕ҧ͏ͬͯԥΒΕͳ͘ͳͬͨ (29ࡀ உੑ) • ੜࣦഊͨ͠ͱ͖ͷΤϥʔ͕Θ͔Γʹ͍͘ (29ࡀ உੑ)
·ͱΊ • Go ྑ͍ݴޠ ͚ͩͲ • Web API ࡞Δͱ͖ɺJSONͷܕఆٛͭΒ͍ •
ಛʹϦϦʔεޙมߋଟ͍ • JSON Hyper-Schema Λ prmd ͳͲͷิॿπʔϧͰੜͯ͠ • υΩϡϝϯτɺܕఆٛɺόϦσʔλɺϋϯυϥͷͻͳܗΛੜ͢Δ ͱ • ͱͯޮతɺݎ࿚ͳ։ൃαΠΫϧ͕Ͱ͖͕͋ΔͷͰ͓͢͢Ί
Thank you! Any questions?