No operations defined in spec Node.js Express - javascript

swagger ui
i'm trying to solve this problem but somehow i still didn't manage to do it. /swagger endpoint seems to read only part of the swagger.json file. I configured everything and still not a single error popped up. It just says "No operations defined in spec" even tho i created one test model. Googling this was a disaster,so few articles and they are all different completely.
in app.js i added :
import swaggerUi from "swagger-ui-express";
import * as swaggerDoc from "./swagger.json";
app.use("/swagger", swaggerUi.serve, swaggerUi.setup(swaggerDoc));
in swagger.json :
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Stefan Back-end Swagger",
"description": "Test",
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"Cat": {
"type": "object",
"properties": {
"genus": {
"type": "string"
}
}
}
}

You are using openapi-3, look at the components section,
Your swagger.json file should be like:
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "Stefan Back-end Swagger",
"description": "Test",
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"components": {
"schema": {
"Cat": {
"type": "object",
"properties": {
"genus": {
"type": "string"
}
}
}
}
}
}
Hope this help.

Related

Error: Problem validating fields in app.json. See https://docs.expo.io/workflow/configuration/ • should NOT have additional property 'nodeModulesPath

Trying to use expo publish in order to host my react native app and show other people but running into this error. It seems to indicate the need for the removal of a 'nodeModedulesPath' property from my app.json but ...well here is the structure. I'm not quite sure what needs to be removed or why, any help would be greatly appreciated.
{
"expo": {
"name": "new",
"slug": "new",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#9CB2A5"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#9CB2A5"
}
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
[
"expo-notifications",
{
"icon": "./assets/icon.png",
"color": "#ffffff",
"sounds": [
"./local/assets/notification-sound.wav",
"./local/assets/notification-sound-other.wav"
]
}
]
],
"extra": {
"eas": {
"projectId": "027e8e01-7c7e-4212-8812-a49f5db4f826"
}
}
}
}
I tried finding the nodeModulesPath, there is no string with those characters in the entire project directory, and the configuration workflow shown in expo's documentation doesn't exactly explain what would cause this error.

how to import the HttpClientModule in the root module of the application using ng-add schematics

I have a project in angular and I need to add the HttpClientModule, how do I do this using schematics ng-add ?
I believe it is the change in shema.json
{
"$schema": "http://json-schema.org/schema",
"$id": "SchematicsNgAdd",
"title": "Ng Add Options Schema",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "Name of the project.",
"$default": {
"$source": "projectName"
}
},
"configSideMenu": {
"type": "boolean",
"description": "When true create a app.component with po-toolbar and po-menu configured.",
"default": true,
"x-prompt": "Would you like to configure Sidemenu?",
"x-user-analytics": 17
}
},
"required": []
}

I need recommendation for structure to use Cytoscape js

We are using Cytoscape + neo4j + spring boot + REST. We've tried to use some formats pass to frontend, however didn't work that well. So looking for best structure to use Cytoscape js.
========
Added later.
For example response from neo4j apoc export json query would be like this:
{
"application": {
"type": "node",
"id": "hhj354",
"labels": [
"Application"
],
"properties": {
"appid": "A90378",
"name": "hkjgj",
"status": "In Production"
}
},
"changes": [
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": sfd
},
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": sfd
},
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": 453
}
]
}
I need some detailed parsing codes. Parsing in backend or front end both ok as long as short enough.
Thanks in advance.
As far as I'm concerned, the front-end should do the less calculations as possible.
Therefore, try to send a JSON as close as possible to the format specified in the specs of cytoscape.js
The basic idea of graph is that it's composed of nodes and edges, those elements (as cytoscape calls them) have ids that can help you select them in a easier way.
No Calculation in Back-End
If you want to use built-in format .json from CALL apoc.export.json.all("all.json",{useTypes:true})then you will have for example to do some transformation in the front-end:
responseJson => {
responseJson.map(element => {
return {
group: element.type,
data : {
id: `${element.type}${element.id}`,
myFavouriteProperty: element.property
}
}
}

How to implement Google AdMob service in React Native?

While working with testing ads, it was fine, but with real ad units, it didn't show up, and most importantly how to implement For the module to attribute interactions with ads to your AdMob app properly you will need to add a googleMobileAdsAppId property to app.json under [platform].config."
enter image description here
change googleMoblieAppId to your own app id. The one you get from admob.
{
"expo": {
"name": "YourappName",
"slug": "Slugname",
"privacy": "public",
"android": {
"package": "in.learner.yourappname",
"versionCode": 1,
"config": {
"googleMobileAdsAppId": "yourGoogleAppId goes here"
}
},
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"config": {
"googleMobileAdsAppId": "your GoogleAppId goes here"
}
}
}
}

How to send email using azure JavaScript function?

its my index.js file code.which i have taken a refrence from this link Javascript Azure Function to send email using SendGrid
module.exports = async function (context, req) {
var message = {
"personalizations": [ { "to": [ { "email": "testto#gmail.com" } ] } ],
from: { email: "testfrom#gmail.com" },
subject: "Azure news",
content: [{
type: 'application/json',
value: req.body.to
}]
};
context.done(null, {message});
};
This is the function.json file code.
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"name": "$return",
"type": "sendGrid",
"direction": "out",
"apiKey" : "SG.O1pazBKvS5Ox4YExYCY...",
"to": "df#mail.com ",
"from": "gh#gmail.com",
"subject": "SendGrid output bindings"
}
]
}
This is root directory local.setting.json file.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "node",
"SENDGRID_API_KEY": "SG.O1pazBKvS5Ox4YExYCY...."
}
}
This is root directory host.json file
{
"version": "2.0",
"extensions": {
"sendGrid": {
"from": "Azure Functions <samples#functions.com>"
}
}
}
Following error i am getting in the console. Also , what is the correct way to send this email.? Reference taken for configuration file https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-sendgrid
Looks like you don't have the binding extension installed. You could either
Use Extension Bundles by updating your host.json to something like this
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"extensions": {
"sendGrid": {
"from": "Azure Functions <samples#functions.com>"
}
}
}
Install the function extension using the dotnet CLI (Would need .NET Core installed locally)
dotnet add package Microsoft.Azure.WebJobs.Extensions.SendGrid --version 3.0.0

Categories

Resources