I'm not sure how Sun/Moon work data wise, but to ensure your Pokemon are legal you can go through extra effort.
Like for breedable Pokemon, make a perfect ditto and perfect mon, then breed them, and the resulting egg should be fine (it's like a 1/6 chance to get what you want, depending).
I don't know if that level of work is necessary though. I recently registered to ask a similar question about whether doing something like editing a nature will result in a legal Pokemon, so I figured I would post here.
EDIT: http://bulbapedia.bulbagarden.net/wiki/Personality_value I found this page to be useful. It seems nature is its own seperate byte, so if you take a legitimate pokemon and edit its nature, it'll still be legal.